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 2007/10/22 23:30:57 UTC

svn commit: r587269 - in /incubator/cxf/branches/2.0.x-fixes: ./ 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/

Author: dkulp
Date: Mon Oct 22 14:30:56 2007
New Revision: 587269

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

........
  r587232 | dkulp | 2007-10-22 16:18:32 -0400 (Mon, 22 Oct 2007) | 3 lines
  
  [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/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Messages.properties
    incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java

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

Modified: incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?rev=587269&r1=587268&r2=587269&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java Mon Oct 22 14:30:56 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/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Messages.properties?rev=587269&r1=587268&r2=587269&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Messages.properties (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Messages.properties Mon Oct 22 14:30:56 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/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?rev=587269&r1=587268&r2=587269&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java Mon Oct 22 14:30:56 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/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=587269&r1=587268&r2=587269&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java Mon Oct 22 14:30:56 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/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java?rev=587269&r1=587268&r2=587269&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java Mon Oct 22 14:30:56 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);