cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1128077 - in /cxf/trunk/rt/frontend: jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Date Thu, 26 May 2011 20:52:52 GMT
Author: dkulp
Date: Thu May 26 20:52:51 2011
New Revision: 1128077

URL: http://svn.apache.org/viewvc?rev=1128077&view=rev
Log:
[CXF-2766] Fix issue with code first services that have parts starting
with "return" not honoring the partnames correctly.

Modified:
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java?rev=1128077&r1=1128076&r2=1128077&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java Thu
May 26 20:52:51 2011
@@ -24,6 +24,9 @@ import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.Executor;
 
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
 import javax.jws.WebService;
 import javax.jws.soap.SOAPBinding;
 import javax.wsdl.Definition;
@@ -65,6 +68,7 @@ import org.junit.Test;
 
 
 public class CodeFirstTest extends AbstractJaxWsTest {
+
     String address = "local://localhost:9000/Hello";
     
     @Test
@@ -469,4 +473,54 @@ public class CodeFirstTest extends Abstr
             return message;
         }
     }
+    
+    @Test
+    public void testCXF2766() throws Exception {
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); 
+        factory.setServiceClass(CXF2766.class); 
+        factory.setServiceBean(new CXF2766Impl()); 
+        factory.setAddress("local://localhost/testcxf2766"); 
+        Server server = factory.create();
+        server.getEndpoint().getInInterceptors().add(new LoggingInInterceptor());
+        server.getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor());
+        Document doc = getWSDLDocument(server);
+        //org.apache.cxf.helpers.XMLUtils.printDOM(doc);
+        assertValid("//wsdl:message[@name='doReturnResponse']/wsdl:part[@name='returnResponse']",
doc);
+        
+        QName serviceName = new QName("http://cxf.apache.org/service.wsdl", "BareService");
+        QName portName = new QName("http://cxf.apache.org/service.wsdl", "BarePort");
+
+        ServiceImpl service = new ServiceImpl(getBus(), (URL)null, serviceName, null);
+        service.addPort(portName, "http://schemas.xmlsoap.org/soap/",
+                        "local://localhost/testcxf2766"); 
+        CXF2766 proxy = service.getPort(portName, CXF2766.class);
+        proxy.doReturn(new ReturnRequestType());
+    }
+    @WebService(targetNamespace = "http://cxf.apache.org/service.wsdl")
+    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+    public static interface CXF2766 {
+        @WebResult(name = "return-response", 
+                   targetNamespace = "http://cxf.apache.org/service.wsdl/types",
+                   partName = "returnResponse")
+        @WebMethod(action = "http://cxf.apache.org/doReturn")
+        ReturnResponseType 
+        doReturn(@WebParam(partName = "returnTrx",
+                           name = "return-request", 
+                           targetNamespace = "http://cxf.apache.org/service.wsdl/types")
+                           ReturnRequestType returnTrx);
+    }
+    @WebService(targetNamespace = "http://cxf.apache.org/service.wsdl")
+    public static class CXF2766Impl implements CXF2766 {
+        public ReturnResponseType doReturn(ReturnRequestType returnTrx) {
+            return new ReturnResponseType();
+        }
+    }
+    
+    @XmlType(name = "ReturnRequestType", namespace = "http://cxf.apache.org/service.wsdl/types")
+    public static class ReturnRequestType {
+    }
+    @XmlType(name = "ReturnResponseType", namespace = "http://cxf.apache.org/service.wsdl/types")
+    public static class ReturnResponseType {
+    }
+
 }

Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=1128077&r1=1128076&r2=1128077&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Thu May 26 20:52:51 2011
@@ -1101,18 +1101,16 @@ public class ReflectionServiceFactoryBea
             XmlSchema schema = null;
 
             QName qname = (QName)mpi.getProperty(ELEMENT_NAME);
-            if (message.getMessageParts().size() == 1) {
-                qname = qname == null && !isOut ? getInParameterName(opInfo, method,
-1) : qname;
-                qname = qname == null && isOut ? getOutParameterName(opInfo, method,
-1) : qname;
+            if (message.getMessageParts().size() == 1 && qname == null) {
+                qname = !isOut ? getInParameterName(opInfo, method, -1) 
+                        : getOutParameterName(opInfo, method, -1);
+                
                 if (qname.getLocalPart().startsWith("arg") || qname.getLocalPart().startsWith("return"))
{
                     qname = isOut
                         ? new QName(qname.getNamespaceURI(), method.getName() + "Response")
: new QName(qname
                             .getNamespaceURI(), method.getName());
                 }
-
-            }
-
-            if (isOut && message.getMessageParts().size() > 1 && qname
== null) {
+            } else if (isOut && message.getMessageParts().size() > 1 &&
qname == null) {
                 while (!isOutParam(method, paraNumber)) {
                     paraNumber++;
                 }



Mime
View raw message