You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2013/09/13 18:20:09 UTC

svn commit: r1523002 - in /cxf/branches/2.7.x-fixes: api/src/main/java/org/apache/cxf/interceptor/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ systests/jaxws/src/test/java/org/apac...

Author: dkulp
Date: Fri Sep 13 16:20:09 2013
New Revision: 1523002

URL: http://svn.apache.org/r1523002
Log:
Merged revisions 1522999 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1522999 | dkulp | 2013-09-13 12:16:11 -0400 (Fri, 13 Sep 2013) | 2 lines

  [CXF-5268] Force everything to doc/lit/bare for provider/dispatch things

........

Modified:
    cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
    cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java

Modified: cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java?rev=1523002&r1=1523001&r2=1523002&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java (original)
+++ cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java Fri Sep 13 16:20:09 2013
@@ -85,9 +85,13 @@ public class DocLiteralInInterceptor ext
 
         Service service = ServiceModelUtil.getService(message.getExchange());
         bop = getBindingOperationInfo(xmlReader, exchange, bop, client);
-
+        boolean forceDocLitBare = false;
+        if (bop != null && bop.getBinding() != null) {
+            forceDocLitBare = Boolean.TRUE.equals(bop.getBinding().getService().getProperty("soap.force.doclit.bare"));
+        }
+        
         try {
-            if (bop != null && bop.isUnwrappedCapable()) {
+            if (!forceDocLitBare && bop != null && bop.isUnwrappedCapable()) {
                 ServiceInfo si = bop.getBinding().getService();
                 // Wrapped case
                 MessageInfo msgInfo = setMessage(message, bop, client, si);
@@ -179,15 +183,14 @@ public class DocLiteralInInterceptor ext
                         p = findMessagePart(exchange, operations, elName, client, paramNum, message);
                     }
                     
-                    boolean dlb = Boolean.TRUE.equals(si.getProperty("soap.force.doclit.bare"));
-                    if (!dlb) {
+                    if (!forceDocLitBare) {
                         //Make sure the elName found on the wire is actually OK for 
                         //the purpose we need it
                         validatePart(p, elName, message);
                     }
              
                     o = dr.read(p, xmlReader);
-                    if (dlb && parameters.isEmpty()) {
+                    if (forceDocLitBare && parameters.isEmpty()) {
                         // webservice provider does not need to ensure size
                         parameters.add(o);
                     } else {

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=1523002&r1=1523001&r2=1523002&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Fri Sep 13 16:20:09 2013
@@ -90,6 +90,7 @@ import org.apache.cxf.service.factory.Ab
 import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
 import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.service.model.ServiceModelUtil;
@@ -295,6 +296,16 @@ public class ServiceImpl extends Service
                     ei.setProperty("soap.no.validate.parts", Boolean.TRUE);
                 }
             }
+            
+            for (BindingInfo bind : si.getBindings()) {
+                for (BindingOperationInfo bop : bind.getOperations()) {
+                    //force to bare, no unwrapping
+                    if (bop.isUnwrappedCapable()) {
+                        bop.getOperationInfo().setUnwrappedOperation(null);
+                        bop.setUnwrappedOperation(null);
+                    }
+                }
+            }
         }
         return serviceFactory;
     }    

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?rev=1523002&r1=1523001&r2=1523002&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java Fri Sep 13 16:20:09 2013
@@ -332,6 +332,11 @@ public class JaxWsServiceFactoryBean ext
                 for (BindingInfo bind : si.getBindings()) {
                     for (BindingOperationInfo bop : bind.getOperations()) {
                         OperationInfo o = bop.getOperationInfo();
+                        if (bop.isUnwrappedCapable()) {
+                            //force to bare, no unwrapping
+                            bop.getOperationInfo().setUnwrappedOperation(null);
+                            bop.setUnwrappedOperation(null);
+                        }
                         if (o.getInput() != null) {
                             if (o.getInput().getMessageParts().isEmpty()) {
                                 MessagePartInfo inf = o.getInput().addMessagePart(o.getName());

Modified: cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java?rev=1523002&r1=1523001&r2=1523002&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java (original)
+++ cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java Fri Sep 13 16:20:09 2013
@@ -29,6 +29,7 @@ import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
+import javax.jws.WebService;
 import javax.xml.bind.JAXBContext;
 import javax.xml.namespace.QName;
 import javax.xml.soap.MessageFactory;
@@ -46,6 +47,8 @@ import javax.xml.ws.Response;
 import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.soap.Addressing;
+import javax.xml.ws.soap.AddressingFeature;
 import javax.xml.ws.soap.SOAPBinding;
 import javax.xml.ws.soap.SOAPFaultException;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
@@ -70,7 +73,7 @@ import org.apache.cxf.testutil.common.Te
 import org.apache.cxf.transport.http.HTTPConduit;
 import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
 import org.apache.hello_world_soap_http.BadRecordLitFault;
-import org.apache.hello_world_soap_http.GreeterImpl;
+import org.apache.hello_world_soap_http.BaseGreeterImpl;
 import org.apache.hello_world_soap_http.SOAPService;
 import org.apache.hello_world_soap_http.types.GreetMe;
 import org.apache.hello_world_soap_http.types.GreetMeLater;
@@ -89,6 +92,16 @@ public class DispatchClientServerTest ex
 
     private static String greeterPort = TestUtil.getPortNumber(DispatchClientServerTest.class); 
     
+    
+    @WebService(serviceName = "SOAPService",
+        portName = "SoapPort",
+        endpointInterface = "org.apache.hello_world_soap_http.Greeter",
+        targetNamespace = "http://apache.org/hello_world_soap_http",
+        wsdlLocation = "testutils/hello_world.wsdl")
+    @Addressing
+    public static class GreeterImpl extends BaseGreeterImpl {
+    }    
+    
     public static class Server extends AbstractBusTestServerBase {        
         Endpoint ep;
         
@@ -99,7 +112,6 @@ public class DispatchClientServerTest ex
                 + TestUtil.getPortNumber(DispatchClientServerTest.class)
                 + "/SOAPDispatchService/SoapDispatchPort";
             ep = Endpoint.create(SOAPBinding.SOAP11HTTP_BINDING, implementor);
-            
             Map<String, Object> properties = new HashMap<String, Object>();
             Map<String, String> nsMap = new HashMap<String, String>();
             nsMap.put("gmns", "http://apache.org/hello_world_soap_http/types");
@@ -512,6 +524,28 @@ public class DispatchClientServerTest ex
         
         JAXBContext jc = JAXBContext.newInstance("org.apache.hello_world_soap_http.types");
         Dispatch<Object> disp = service.createDispatch(PORT_NAME, jc, Service.Mode.PAYLOAD);
+        doJAXBPayload(disp);
+    }
+    @Test
+    public void testJAXBObjectPAYLOADFromEPR() throws Exception {
+        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
+        assertNotNull(wsdl);
+
+        SOAPService service = new SOAPService(wsdl, SERVICE_NAME);
+        assertNotNull(service);
+
+        W3CEndpointReferenceBuilder builder = new  W3CEndpointReferenceBuilder();
+        builder.address("http://localhost:" 
+                        + greeterPort 
+                        + "/SOAPDispatchService/SoapDispatchPort");
+        builder.serviceName(SERVICE_NAME);
+        builder.endpointName(PORT_NAME);
+        W3CEndpointReference w3cEpr = builder.build();
+        JAXBContext jc = JAXBContext.newInstance("org.apache.hello_world_soap_http.types");
+        Dispatch<Object> disp = service.createDispatch(w3cEpr, jc, Service.Mode.PAYLOAD, new AddressingFeature());
+        doJAXBPayload(disp);
+    }
+    private void doJAXBPayload(Dispatch<Object> disp) throws Exception {
         disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                                      "http://localhost:" 
                                      + greeterPort