cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject svn commit: r798479 - /cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
Date Tue, 28 Jul 2009 10:18:25 GMT
Author: asoldano
Date: Tue Jul 28 10:18:24 2009
New Revision: 798479

URL: http://svn.apache.org/viewvc?rev=798479&view=rev
Log:
[CXF-2364] Allow SOAP address rewrite in wsdl according to the request call

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?rev=798479&r1=798478&r2=798479&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java Tue
Jul 28 10:18:24 2009
@@ -207,7 +207,7 @@
                 doc = XMLUtils.getParser().parse(src);
             }
             
-            updateDoc(doc, base, mp, smp);
+            updateDoc(doc, base, mp, smp, endpointInfo);
             String enc = doc.getXmlEncoding();
             if (enc == null) {
                 enc = "utf-8";
@@ -226,9 +226,10 @@
         }
     }
     
-    private void updateDoc(Document doc, String base,
+    protected void updateDoc(Document doc, String base,
                            Map<String, Definition> mp,
-                           Map<String, SchemaReference> smp) {        
+                           Map<String, SchemaReference> smp,
+                           EndpointInfo ei) {        
         List<Element> elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
                                                                        "http://www.w3.org/2001/XMLSchema",
                                                                        "import");
@@ -258,6 +259,24 @@
                 el.setAttribute("location", base + "?wsdl=" + sl);
             }
         }
+        
+        Boolean rewriteSoapAddress = ei.getProperty("autoRewriteSoapAddress", Boolean.class);
+        if (rewriteSoapAddress != null && rewriteSoapAddress.booleanValue()) {
+            elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
+                                                              "http://schemas.xmlsoap.org/wsdl/",
+                                                              "port");
+            for (Element el : elementList) {
+                String name = el.getAttribute("name");
+                if (name.equals(ei.getName().getLocalPart())) {
+                    Element soapAddress = DOMUtils.findAllElementsByTagNameNS(el,
+                                                               "http://schemas.xmlsoap.org/wsdl/soap/",
+                                                               "address")
+                                                               .iterator().next();
+                    soapAddress.setAttribute("location", base);
+                }
+            }
+        }
+        
         doc.setXmlStandalone(true);
     }
 



Mime
View raw message