cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r587232 - in /incubator/cxf/trunk: rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ systests/src/test/java/org/apache/cxf/systest/jaxws/
Date Mon, 22 Oct 2007 20:18:33 GMT
Author: dkulp
Date: Mon Oct 22 13:18:32 2007
New Revision: 587232

URL: http://svn.apache.org/viewvc?rev=587232&view=rev
Log:
[CXF-1092, CXF-1127] Fix problems mapping part names from wsdl to annotations
Fix issues with duplicate fault elements being created in JAXB

Modified:
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Messages.properties
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?rev=587232&r1=587231&r2=587232&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
(original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
Mon Oct 22 13:18:32 2007
@@ -154,20 +154,20 @@
 
     private void createBridgeXsElement(MessagePartInfo part, QName qn, QName typeName) {
         XmlSchemaElement el = null;
-        SchemaInfo schemaInfo = null;
-        for (SchemaInfo s : serviceInfo.getSchemas()) {
-            if (s.getNamespaceURI().equals(qn.getNamespaceURI())) {
-                schemaInfo = s;
-
+        SchemaInfo schemaInfo = serviceInfo.getSchema(qn.getNamespaceURI());
+        if (schemaInfo != null) {
+            el = schemaInfo.getElementByQName(qn);
+            if (el == null) {
                 el = createXsElement(part, typeName, schemaInfo);
 
                 schemaInfo.getSchema().getElements().add(el.getQName(), el);
                 schemaInfo.getSchema().getItems().add(el);
-                
-                return;
+            } else if (!typeName.equals(el.getSchemaTypeName())) {
+                throw new Fault(new Message("CANNOT_CREATE_ELEMENT", LOG, 
+                                            qn, typeName, el.getSchemaTypeName()));
             }
+            return;
         }
-        
         schemaInfo = new SchemaInfo(serviceInfo, qn.getNamespaceURI());
         el = createXsElement(part, typeName, schemaInfo);
 
@@ -205,29 +205,24 @@
             if (beanInfo == null) {
                 throw new Fault(new Message("NO_BEAN_INFO", LOG, cls.getName()));
             }
-            SchemaInfo schemaInfo = null;
-            for (SchemaInfo s : serviceInfo.getSchemas()) {
-                if (s.getNamespaceURI().equals(part.getElementQName().getNamespaceURI())
-                    && !isExistSchemaElement(s.getSchema(), part.getElementQName()))
{
-                    schemaInfo = s;
-                    
-                    XmlSchemaElement el = new XmlSchemaElement();
-                    el.setQName(part.getElementQName());
-                    el.setName(part.getElementQName().getLocalPart());
-                    el.setNillable(true);
+            SchemaInfo schemaInfo = serviceInfo.getSchema(part.getElementQName().getNamespaceURI());
+            if (schemaInfo != null
+                && !isExistSchemaElement(schemaInfo.getSchema(), part.getElementQName()))
{
                     
-                    schemaInfo.getSchema().getItems().add(el);
-                    schemaInfo.getSchema().getElements().add(el.getQName(), el);
-
-                    Iterator<QName> itr = beanInfo.getTypeNames().iterator();
-                    if (!itr.hasNext()) {
-                        continue;
-                    }
-                    QName typeName = itr.next();
-                    el.setSchemaTypeName(typeName);
+                XmlSchemaElement el = new XmlSchemaElement();
+                el.setQName(part.getElementQName());
+                el.setName(part.getElementQName().getLocalPart());
+                el.setNillable(true);
+                
+                schemaInfo.getSchema().getItems().add(el);
+                schemaInfo.getSchema().getElements().add(el.getQName(), el);
 
+                Iterator<QName> itr = beanInfo.getTypeNames().iterator();
+                if (!itr.hasNext()) {
                     return;
                 }
+                QName typeName = itr.next();
+                el.setSchemaTypeName(typeName);
             }
         } 
     }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Messages.properties?rev=587232&r1=587231&r2=587232&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Messages.properties
(original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Messages.properties
Mon Oct 22 13:18:32 2007
@@ -28,4 +28,5 @@
 SCHEMA_GEN_EXC = Could not generate schemas.
 CREATED_JAXB_CONTEXT = Created JAXBContext "{0}" with classes {1}.
 NO_BEAN_INFO = Could not find JAXB information for bean class {0} in context.   Make sure
it follows JAXB conventions.
+CANNOT_CREATE_ELEMENT = Cannot create element {0} with type of {1} due to element already
exists with type {2}.
  

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?rev=587232&r1=587231&r2=587232&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
Mon Oct 22 13:18:32 2007
@@ -244,7 +244,11 @@
         String tns = null;
         String local = null;
         if (param != null) {
-            tns = param.targetNamespace();
+            //if it's a "wrapped" thing, the WebParam namespace is irrelevant
+            //as the generated element has to be in the namespace of the wrapper type
+            if (param.header() || !op.isUnwrapped()) {
+                tns = param.targetNamespace();
+            }
             local = param.name();
         }
         
@@ -341,7 +345,11 @@
             String tns = null;
             String local = null;
             if (webResult != null) {
-                tns = webResult.targetNamespace();
+                //if it's a "wrapped" thing, the WebResult namespace is irrelevant
+                //as the generated element has to be in the namespace of the wrapper type
+                if (webResult.header() || !op.isUnwrapped()) {
+                    tns = webResult.targetNamespace();
+                }
                 local = webResult.name();
             }
             if (tns == null || tns.length() == 0) {

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=587232&r1=587231&r2=587232&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
Mon Oct 22 13:18:32 2007
@@ -58,7 +58,7 @@
 
     @BeforeClass
     public static void startServers() throws Exception {
-        assertTrue("server did not launch correctly", launchServer(ServerMisc.class));
+        assertTrue("server did not launch correctly", launchServer(ServerMisc.class, true));
     }
     
     @Test

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java?rev=587232&r1=587231&r2=587232&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
Mon Oct 22 13:18:32 2007
@@ -93,7 +93,7 @@
     @RequestWrapper(className = "org.apache.cxf.systest.jaxws.Echo")
     @ResponseWrapper(className = "org.apache.cxf.systest.jaxws.EchoResponse")
     String echo(@WebParam(targetNamespace = 
-            "http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService", 
+            "http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService2", 
                           name = "String_1")
                         String msg);
 



Mime
View raw message