cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r532926 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/ rt/frontend/jaxws/src/main/java/...
Date Fri, 27 Apr 2007 01:35:36 GMT
Author: dkulp
Date: Thu Apr 26 18:35:35 2007
New Revision: 532926

URL: http://svn.apache.org/viewvc?view=rev&rev=532926
Log:
Fix issue with namespace not put on soap:body in rpc mode
Fix issues with JAX-WS Soap handlers prior to dispatch possibly causing the message to not
be parsable

Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_rpc.wsdl

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java?view=diff&rev=532926&r1=532925&r2=532926
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java Thu
Apr 26 18:35:35 2007
@@ -41,6 +41,9 @@
     public String getTransportId() {
         return transportId;
     }    
+    public void setTransportId(String tid) {
+        transportId = tid;
+    }
     public InterfaceInfo getInterface() {
         return service.getInterface();
     }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java?view=diff&rev=532926&r1=532925&r2=532926
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java
Thu Apr 26 18:35:35 2007
@@ -128,6 +128,7 @@
                                                                                   isSoap12);
                 soapOperation.setSoapActionURI(soi.getAction());
                 soapOperation.setStyle(soi.getStyle());
+                boolean isRpc = "rpc".equals(soapOperation.getStyle());
 
                 b.addExtensor(soapOperation);
 
@@ -151,6 +152,9 @@
                                                                    BindingInput.class,
                                                                    isSoap12);
                     body.setUse("literal");
+                    if (isRpc) {
+                        body.setNamespaceURI(b.getName().getNamespaceURI());
+                    }
 
                     if (!StringUtils.isEmpty(bodyParts)) {
                         body.setParts(bodyParts);
@@ -179,6 +183,9 @@
                                                                    BindingOutput.class,
                                                                    isSoap12);
                     body.setUse("literal");
+                    if (isRpc) {
+                        body.setNamespaceURI(b.getName().getNamespaceURI());
+                    }
 
                     if (!StringUtils.isEmpty(bodyParts)) {
                         body.setParts(bodyParts);
@@ -194,26 +201,22 @@
     }
     
     public EndpointInfo createEndpointInfo(ServiceInfo serviceInfo, BindingInfo b, Port port)
{
-        List ees = port.getExtensibilityElements();
-        for (Iterator itr = ees.iterator(); itr.hasNext();) {
-            Object extensor = itr.next();
-
-            if (SOAPBindingUtil.isSOAPAddress(extensor)) {
-                final SoapAddress sa = SOAPBindingUtil.getSoapAddress(extensor);
-
-                SoapBindingInfo sbi = (SoapBindingInfo)b;
-                EndpointInfo info = new EndpointInfo(serviceInfo, sbi.getTransportURI())
{
-                    public void setAddress(String s) {
-                        super.setAddress(s);
-                        sa.setLocationURI(s);
-                    }
-                };
-                info.setAddress(sa.getLocationURI());
-                return info;
+        SoapBindingInfo sbi = (SoapBindingInfo)b;
+        if (port != null) {
+            List ees = port.getExtensibilityElements();
+            for (Iterator itr = ees.iterator(); itr.hasNext();) {
+                Object extensor = itr.next();
+    
+                if (SOAPBindingUtil.isSOAPAddress(extensor)) {
+                    final SoapAddress sa = SOAPBindingUtil.getSoapAddress(extensor);
+    
+                    EndpointInfo info = new SoapEndpointInfo(serviceInfo, sbi.getTransportURI());
+                    info.setAddress(sa.getLocationURI());
+                    return info;
+                }
             }
         }
-
-        return null;
+        return new SoapEndpointInfo(serviceInfo, sbi.getTransportURI());
     }
 
 
@@ -262,6 +265,25 @@
             }
         }
     }
+    
+    private static class SoapEndpointInfo extends EndpointInfo {
+        SoapAddress saddress;
+        SoapEndpointInfo(ServiceInfo serv, String trans) {
+            super(serv, trans);
+        }
+        public void setAddress(String s) {
+            super.setAddress(s);
+            if (saddress != null) {
+                saddress.setLocationURI(s);
+            }
+        }
 
+        public void addExtensor(Object el) {
+            super.addExtensor(el);
+            if (el instanceof SoapAddress) {
+                saddress = (SoapAddress)el;
+            }
+        }
+    }
 
 }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java?view=diff&rev=532926&r1=532925&r2=532926
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
Thu Apr 26 18:35:35 2007
@@ -82,8 +82,7 @@
             
             XMLStreamReader xmlReader = message.getContent(XMLStreamReader.class);
             StaxUtils.readDocElements(soapMessage.getSOAPBody(), xmlReader, true);
-            
-            DOMSource bodySource = new DOMSource(soapMessage.getSOAPBody());
+            DOMSource bodySource = new DOMSource(soapMessage.getSOAPPart().getEnvelope().getBody());
             xmlReader = StaxUtils.createXMLStreamReader(bodySource);
             xmlReader.nextTag();
             xmlReader.nextTag(); // move past body tag

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java?view=diff&rev=532926&r1=532925&r2=532926
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
Thu Apr 26 18:35:35 2007
@@ -24,7 +24,11 @@
 import java.util.Set;
 
 import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPMessage;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.dom.DOMSource;
 import javax.xml.ws.Binding;
 import javax.xml.ws.handler.Handler;
 import javax.xml.ws.handler.MessageContext;
@@ -40,6 +44,7 @@
 import org.apache.cxf.jaxws.handler.AbstractProtocolHandlerInterceptor;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
+import org.apache.cxf.staxutils.StaxUtils;
 
 public class SOAPHandlerInterceptor extends
         AbstractProtocolHandlerInterceptor<SoapMessage> implements
@@ -97,6 +102,24 @@
             });
         } else {
             super.handleMessage(message);
+            SOAPMessage msg = message.getContent(SOAPMessage.class);
+            if (msg != null) {
+                DOMSource bodySource;
+                try {
+                    bodySource = new DOMSource(msg.getSOAPPart().getEnvelope().getBody());
+                    XMLStreamReader xmlReader = StaxUtils.createXMLStreamReader(bodySource);
+                    xmlReader.nextTag();
+                    xmlReader.nextTag(); // move past body tag
+                    message.setContent(XMLStreamReader.class, xmlReader);
+                } catch (SOAPException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                } catch (XMLStreamException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+
+            }
         }
     }
 

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java?view=diff&rev=532926&r1=532925&r2=532926
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
Thu Apr 26 18:35:35 2007
@@ -195,7 +195,14 @@
             destinationFactory = dfm.getDestinationFactory(transportId);
         }
         
-        EndpointInfo ei = new EndpointInfo(service.getServiceInfos().get(0), transportId);
+        EndpointInfo ei;
+        if (destinationFactory instanceof WSDLEndpointFactory) {
+            ei = ((WSDLEndpointFactory)destinationFactory)
+                .createEndpointInfo(service.getServiceInfos().get(0), bindingInfo, null);
+            ei.setTransportId(transportId);
+        } else {
+            ei = new EndpointInfo(service.getServiceInfos().get(0), transportId);
+        }
         int count = 1;
         while (service.getEndpointInfo(endpointName) != null) {
             endpointName = new QName(endpointName.getNamespaceURI(), 

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java?view=diff&rev=532926&r1=532925&r2=532926
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
Thu Apr 26 18:35:35 2007
@@ -30,6 +30,7 @@
 import javax.annotation.Resource;
 import javax.wsdl.Port;
 import javax.wsdl.extensions.http.HTTPAddress;
+import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.configuration.Configurer;
@@ -175,40 +176,38 @@
         BindingInfo b, 
         Port        port
     ) {
-        List ees = port.getExtensibilityElements();
-        for (Iterator itr = ees.iterator(); itr.hasNext();) {
-            Object extensor = itr.next();
-
-            if (extensor instanceof HTTPAddress) {
-                final HTTPAddress httpAdd = (HTTPAddress)extensor;
-
-                EndpointInfo info = 
-                    new EndpointInfo(serviceInfo, 
-                            "http://schemas.xmlsoap.org/wsdl/http/") {
-                        public void setAddress(String a) {
-                            super.setAddress(a);
-                            httpAdd.setLocationURI(a);
-                        }
-                    };
-                info.setAddress(httpAdd.getLocationURI());
-                return info;
-            } else if (extensor instanceof AddressType) {
-                final AddressType httpAdd = (AddressType)extensor;
-
-                EndpointInfo info = 
-                    new EndpointInfo(serviceInfo, 
-                            "http://schemas.xmlsoap.org/wsdl/http/") {
-                        public void setAddress(String a) {
-                            super.setAddress(a);
-                            httpAdd.setLocation(a);
-                        }
-                    };
-                info.setAddress(httpAdd.getLocation());
-                return info;
+        if (port != null) {
+            List ees = port.getExtensibilityElements();
+            for (Iterator itr = ees.iterator(); itr.hasNext();) {
+                Object extensor = itr.next();
+    
+                if (extensor instanceof HTTPAddress) {
+                    final HTTPAddress httpAdd = (HTTPAddress)extensor;
+    
+                    EndpointInfo info = new HttpEndpointInfo(serviceInfo, 
+                                "http://schemas.xmlsoap.org/wsdl/http/");
+                    info.setAddress(httpAdd.getLocationURI());
+                    info.addExtensor(httpAdd);
+                    return info;
+                } else if (extensor instanceof AddressType) {
+                    final AddressType httpAdd = (AddressType)extensor;
+    
+                    EndpointInfo info = 
+                        new HttpEndpointInfo(serviceInfo, 
+                                "http://schemas.xmlsoap.org/wsdl/http/");
+                    info.setAddress(httpAdd.getLocation());
+                    info.addExtensor(httpAdd);
+                    return info;
+                }
             }
         }
-
-        return null;
+        HttpEndpointInfo hei = new HttpEndpointInfo(serviceInfo, 
+            "http://schemas.xmlsoap.org/wsdl/http/");
+        AddressType at = new AddressType();
+        at.setElementType(new QName("http://schemas.xmlsoap.org/wsdl/http/", "address"));
+        hei.addExtensor(at);
+        
+        return hei;
     }
 
     public void createPortExtensors(EndpointInfo ei, Service service) {
@@ -244,6 +243,26 @@
         } else {
             return new HttpsURLConnectionFactory(
                              configuredConduit.getSslClient());
+        }
+    }   
+    
+    private static class HttpEndpointInfo extends EndpointInfo {
+        AddressType saddress;
+        HttpEndpointInfo(ServiceInfo serv, String trans) {
+            super(serv, trans);
+        }
+        public void setAddress(String s) {
+            super.setAddress(s);
+            if (saddress != null) {
+                saddress.setLocation(s);
+            }
+        }
+
+        public void addExtensor(Object el) {
+            super.addExtensor(el);
+            if (el instanceof AddressType) {
+                saddress = (AddressType)el;
+            }
         }
     }    
 

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java?view=diff&rev=532926&r1=532925&r2=532926
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java
(original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java
Thu Apr 26 18:35:35 2007
@@ -112,7 +112,8 @@
                     unmatched.add(tok2);
                 }
             }
-            assertEquals("Compare failed", tok1, tok2);
+            assertEquals("Compare failed " + location1.getAbsolutePath() 
+                         + " != " + location2.getAbsolutePath(), tok1, tok2);
         }
 
         assertTrue(!st1.hasMoreTokens());

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_rpc.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_rpc.wsdl?view=diff&rev=532926&r1=532925&r2=532926
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_rpc.wsdl
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_rpc.wsdl
Thu Apr 26 18:35:35 2007
@@ -39,10 +39,10 @@
     <wsdl:operation name="getPrice">
       <soap:operation soapAction="" style="rpc"/>
       <wsdl:input name="getPrice">
-        <soap:body use="literal"/>
+        <soap:body use="literal" namespace="http://rpc.classnoanno.fortest.tools.cxf.apache.org/"/>
       </wsdl:input>
       <wsdl:output name="getPriceResponse">
-        <soap:body use="literal"/>
+        <soap:body use="literal" namespace="http://rpc.classnoanno.fortest.tools.cxf.apache.org/"/>
       </wsdl:output>
     </wsdl:operation>
   </wsdl:binding>



Mime
View raw message