cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1231311 - in /cxf/branches/2.4.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java
Date Fri, 13 Jan 2012 21:28:43 GMT
Author: dkulp
Date: Fri Jan 13 21:28:42 2012
New Revision: 1231311

URL: http://svn.apache.org/viewvc?rev=1231311&view=rev
Log:
Merged revisions 1231305 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes

................
  r1231305 | dkulp | 2012-01-13 16:22:03 -0500 (Fri, 13 Jan 2012) | 10 lines
  
  Merged revisions 1231301 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1231301 | dkulp | 2012-01-13 16:16:37 -0500 (Fri, 13 Jan 2012) | 2 lines
    
    [CXF-4016] Fix problems of having only an XmlRootElement annotation on a
    fault bean
  ........
................

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
    cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java

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

Modified: cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?rev=1231311&r1=1231310&r2=1231311&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
Fri Jan 13 21:28:42 2012
@@ -575,7 +575,6 @@ class JAXBSchemaInitializer extends Serv
                               XmlSchemaSequence seq, JAXBBeanInfo beanInfo,
                               QName name, boolean isArray) {
         XmlSchemaElement el = new XmlSchemaElement(schema, false);
-        el.setName(name.getLocalPart());
 
         if (isArray) {
             el.setMinOccurs(0);
@@ -590,9 +589,9 @@ class JAXBSchemaInitializer extends Serv
             QName ename = new QName(beanInfo.getElementNamespaceURI(null),
                                    beanInfo.getElementLocalName(null));
             XmlSchemaElement el2 = schemas.getElementByQName(ename);
-            el.setName(null);
-            el.getRef().setTargetQName(el2.getRef().getTargetQName());
+            el.getRef().setTargetQName(el2.getQName());
         } else {
+            el.setName(name.getLocalPart());
             Iterator<QName> itr = beanInfo.getTypeNames().iterator();
             if (!itr.hasNext()) {
                 return;

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java?rev=1231311&r1=1231310&r2=1231311&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java
Fri Jan 13 21:28:42 2012
@@ -22,8 +22,11 @@ import java.util.Collection;
 
 import javax.jws.WebService;
 import javax.wsdl.Definition;
+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.ws.WebFault;
 
 import org.w3c.dom.Document;
 
@@ -196,6 +199,76 @@ public class CodeFirstWSDLTest extends A
 
     
     @Test
+    public void testOnlyRootElementOnFaultBean() throws Exception {
+        //CXF-4016
+        EndpointImpl ep = (EndpointImpl)Endpoint.publish("local://foo4016", new CXF4016Impl());
+        ServiceWSDLBuilder wsdlBuilder = 
+            new ServiceWSDLBuilder(bus, ep.getService().getServiceInfos().get(0));
+        Definition def = wsdlBuilder.build();
+        Document d = bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter().getDocument(def);
+        this.addNamespace("http://www.example.org/contract/DoubleIt", "tns");
+        //org.apache.cxf.helpers.XMLUtils.printDOM(d);
+        assertValid("//xsd:element[@ref='tns:CustomMessageBean']", d);
+    }
+
+
+    @WebService(targetNamespace = "http://www.example.org/contract/DoubleIt",
+                serviceName = "DoubleItService",
+                portName = "DoubleItPort")
+    public static class CXF4016Impl {
+        public int doubleIt(int numberToDouble) throws CustomException {
+            return numberToDouble * 2;
+        }
+        
+    } 
+    @WebFault(name = "CustomException", targetNamespace = "http://www.example.org/contract/DoubleIt")
+    public static class CustomException extends Exception {
+        private static final long serialVersionUID = 1L;
+        private CustomMessageBean faultInfo; 
+
+        public CustomException(String msg) {
+            super(msg);
+        }
+        public CustomException(String msg, CustomMessageBean b) {
+            super(msg);
+            faultInfo = b;
+        }
+        public CustomMessageBean getCustomMessage() {
+            return faultInfo;
+        }
+        public void setCustomMessage(CustomMessageBean b) {
+            faultInfo = b;
+        }
+    }
+    
+    @XmlRootElement(name = "CustomMessageBean")
+    @XmlType(name = "", propOrder = { "myId", "msg" })
+    public static class CustomMessageBean {
+        String msg;
+        int myId;
+        
+        public CustomMessageBean() {
+        }
+
+        public int getMyId() {
+            return myId;
+        }
+
+        public void setMyId(int myId) {
+            this.myId = myId;
+        }
+
+        public String getMsg() {
+            return msg;
+        }
+
+        public void setMsg(String msg) {
+            this.msg = msg;
+        }
+    }
+    
+    
+    @Test
     public void testDocumentationOnImpl() throws Exception {
         //CXF-3092
         EndpointImpl ep = (EndpointImpl)Endpoint.publish("local://foo", new CXF3092Impl());



Mime
View raw message