cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r764892 - in /cxf/branches/2.1.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/ rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ systests/src/test/java/org/apache/cxf/systest/jaxws/
Date Tue, 14 Apr 2009 17:35:12 GMT
Author: dkulp
Date: Tue Apr 14 17:35:11 2009
New Revision: 764892

URL: http://svn.apache.org/viewvc?rev=764892&view=rev
Log:
Merged revisions 764887 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r764887 | dkulp | 2009-04-14 13:18:23 -0400 (Tue, 14 Apr 2009) | 2 lines
  
  [CXF-2172] Fix issues with RPC/Lit creating element parts intead of type parts
........

Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
    cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Apr 14 17:35:11 2009
@@ -1 +1 @@
-/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606
+/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?rev=764892&r1=764891&r2=764892&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
Tue Apr 14 17:35:11 2009
@@ -177,8 +177,9 @@
             }
             return;
         }
-        
-        boolean isElement = beanInfo.isElement();
+        boolean isElement = beanInfo.isElement() 
+            && !Boolean.TRUE.equals(part.getMessageInfo().getOperation()
+                                        .getProperty("operation.force.types"));
         boolean hasType = !beanInfo.getTypeNames().isEmpty();
         if (isElement && isFromWrapper && hasType) {
             //if there is both a Global element and a global type, AND we are in a wrapper,

Modified: cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=764892&r1=764891&r2=764892&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Tue Apr 14 17:35:11 2009
@@ -131,6 +131,7 @@
     public static final String HEADER = "messagepart.isheader";
     public static final String ELEMENT_NAME = "messagepart.elementName";
     public static final String METHOD = "operation.method";
+    public static final String FORCE_TYPES = "operation.force.types";
     public static final String METHOD_PARAM_ANNOTATIONS = "method.parameters.annotations";
     public static final String METHOD_ANNOTATIONS = "method.return.annotations";
     public static final String PARAM_ANNOTATION = "parameter.annotations";
@@ -786,7 +787,8 @@
         op.setProperty(METHOD_ANNOTATIONS, m.getAnnotations());
         op.setProperty(METHOD_PARAM_ANNOTATIONS, m.getParameterAnnotations());
 
-        if (!isRPC(m) && isWrapped(m)) {
+        boolean isrpc = isRPC(m);
+        if (!isrpc && isWrapped(m)) {
             UnwrappedOperationInfo uOp = new UnwrappedOperationInfo(op);
             uOp.setProperty(METHOD_ANNOTATIONS, m.getAnnotations());
             uOp.setProperty(METHOD_PARAM_ANNOTATIONS, m.getParameterAnnotations());
@@ -818,6 +820,9 @@
                 }
             }
         } else {
+            if (isrpc) {
+                op.setProperty(FORCE_TYPES, Boolean.TRUE);
+            }
             createMessageParts(intf, op, m);
         }
 

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java?rev=764892&r1=764891&r2=764892&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java
(original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java
Tue Apr 14 17:35:11 2009
@@ -19,13 +19,34 @@
 
 package org.apache.cxf.systest.jaxws;
 
+import java.io.InputStream;
 import java.lang.reflect.UndeclaredThrowableException;
-
+import java.net.HttpURLConnection;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.Style;
+import javax.jws.soap.SOAPBinding.Use;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
 import javax.xml.namespace.QName;
 import javax.xml.ws.Endpoint;
+import javax.xml.xpath.XPathConstants;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
 
+import org.apache.cxf.binding.soap.Soap11;
+import org.apache.cxf.helpers.XMLUtils;
+import org.apache.cxf.helpers.XPathUtils;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
-import org.apache.cxf.testutil.common.AbstractClientServerTestBase;
 import org.apache.hello_world_rpclit.GreeterRPCLit;
 import org.apache.hello_world_rpclit.SOAPServiceRPCLit;
 import org.apache.hello_world_rpclit.types.MyComplexStruct;
@@ -34,16 +55,19 @@
 import org.junit.Test;
 
 
-public class ClientServerRPCLitTest extends AbstractClientServerTestBase {
+public class ClientServerRPCLitTest extends AbstractBusClientServerTestBase {
 
     private final QName portName = new QName("http://apache.org/hello_world_rpclit", "SoapPortRPCLit");
 
     public static class Server extends AbstractBusTestServerBase {        
 
         protected void run()  {
+            String address;
             Object implementor = new RPCLitGreeterImpl();
-            String address = "http://localhost:9002/SOAPServiceRPCLit/SoapPort";
+            address = "http://localhost:9002/SOAPServiceRPCLit/SoapPort";
             Endpoint.publish(address, implementor);  
+            address = "http://localhost:9002/TestRPCWsdl";
+            Endpoint.publish(address, new MyService());  
         }
 
         public static void main(String[] args) {
@@ -112,4 +136,98 @@
         }
         
     }
+    
+    @Test
+    public void testNoElementParts() throws Exception {
+        HttpURLConnection httpConnection = 
+            getHttpConnection("http://localhost:9002/TestRPCWsdl?wsdl");    
+        httpConnection.connect();        
+        
+        assertEquals(200, httpConnection.getResponseCode());
+        assertEquals("OK", httpConnection.getResponseMessage());
+        InputStream in = httpConnection.getInputStream();
+        assertNotNull(in);
+        
+        Document doc = XMLUtils.parse(in);
+        assertNotNull(doc);
+        
+        
+        Map<String, String> ns = new HashMap<String, String>();
+        ns.put("soap", Soap11.SOAP_NAMESPACE);
+        ns.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
+        ns.put("xs", "http://www.w3.org/2001/XMLSchema");
+        
+        
+        XPathUtils xu = new XPathUtils(ns);
+        
+        //make sure the wrapper types are anonymous types
+        NodeList ct = (NodeList) xu.getValue("//wsdl:definitions/wsdl:message/wsdl:part[@element
!= '']",
+                                             doc, XPathConstants.NODESET);
+        assertNotNull(ct);
+        assertEquals(0, ct.getLength());
+        
+        ct = (NodeList) xu.getValue("//wsdl:definitions/wsdl:message/wsdl:part[@type != '']",
+                                     doc, XPathConstants.NODESET);
+        assertEquals(4, ct.getLength());
+    }
+    
+    @WebService(serviceName = "MyObjectService", portName = "MyObjectServicePort")
+    @SOAPBinding(use = Use.LITERAL, style = Style.RPC)
+    public static class MyService {
+            
+        @WebMethod
+        public MyObject getMyObject(@WebParam(name = "longField1") long longField1) {
+            return generateMyObject();
+        }
+
+        @WebMethod
+        public int updateMyObject(@WebParam(name = "myObject") MyObject myObject) {
+            return 3;
+        }
+        private static MyObject generateMyObject() {
+            MyObject myObject = new MyObject();
+            
+            long tempLong = 1;
+            myObject.setStringField1("S:" + tempLong++);
+            myObject.setStringField2("S:" + tempLong++);
+            myObject.setLongField1(tempLong++);
+            myObject.setLongField2(tempLong++);
+            return myObject;
+        }
+    }
+    
+    @XmlType(name = "MyObject")
+    @XmlAccessorType(XmlAccessType.PROPERTY)
+    @XmlRootElement(name = "MyObject")
+    public static class MyObject {
+        private String stringField1;
+        private String stringField2;
+        private long longField1;
+        private long longField2;
+        
+        public String getStringField1() {
+            return stringField1;
+        }
+        public void setStringField1(String stringField1) {
+            this.stringField1 = stringField1;
+        }
+        public String getStringField2() {
+            return stringField2;
+        }
+        public void setStringField2(String stringField2) {
+            this.stringField2 = stringField2;
+        }
+        public long getLongField1() {
+            return longField1;
+        }
+        public void setLongField1(long longField1) {
+            this.longField1 = longField1;
+        }
+        public long getLongField2() {
+            return longField2;
+        }
+        public void setLongField2(long longField2) {
+            this.longField2 = longField2;
+        }
+    }
 }



Mime
View raw message