jaxb2 and cxf: multiple changes
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 20 Dec 2015 21:00:13 +0000 (22:00 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 20 Dec 2015 21:00:13 +0000 (22:00 +0100)
41 files changed:
cxf/web-services-spring-cxf-client/pom.xml
cxf/web-services-spring-cxf-client/src/main/build-resources/bindings/custombinding.xjb
cxf/web-services-spring-cxf-client/src/main/build-resources/wsdl/example.wsdl
cxf/web-services-spring-cxf-client/src/main/java/de/spring/webservices/client/ExampleClientService.java
cxf/web-services-spring-cxf-client/src/main/java/de/spring/webservices/client/MainTest.java
cxf/web-services-spring-cxf-client/src/main/resources/examples.xsd
cxf/web-services-spring-cxf-client/src/main/resources/spring-configuration/ws/client-spring-configuration.xml
cxf/web-services-spring-cxf-client/src/test/java/de/spring/webservices/client/ExampleClientServiceIntegrationTest.java
cxf/web-services-spring-cxf-globalxsds/pom.xml
cxf/web-services-spring-cxf-globalxsds/src/main/resources/parent.xsd
cxf/web-services-spring-cxf-server/pom.xml
cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/endpoints/ExampleEndPoint.java
cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/endpoints/MyCustomMappingExceptionResolver.java
cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/services/ExampleService.java
cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/services/impl/CustomBindingExampleServiceImpl.java
cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/services/impl/ExampleServiceImpl.java
cxf/web-services-spring-cxf-server/src/main/resources/examples.xsd
cxf/web-services-spring-cxf-server/src/main/resources/spring-configuration/ws/soap-ws.xml
cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointTest.java
cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/services/CustomBindingExampleServiceTest.java
cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/services/ExampleServiceTest.java
jaxb2/web-services-spring-jaxb2-client/pom.xml
jaxb2/web-services-spring-jaxb2-client/src/main/build-resources/wsdl/example.wsdl
jaxb2/web-services-spring-jaxb2-client/src/main/java/de/spring/webservices/client/ExampleClientService.java
jaxb2/web-services-spring-jaxb2-client/src/main/java/de/spring/webservices/client/MainTest.java
jaxb2/web-services-spring-jaxb2-client/src/main/resources/schemas/examples.xsd
jaxb2/web-services-spring-jaxb2-client/src/main/resources/spring-configuration/ws/client-spring-configuration.xml
jaxb2/web-services-spring-jaxb2-client/src/test/java/de/spring/webservices/client/ExampleClientServiceIntegrationTest.java
jaxb2/web-services-spring-jaxb2-globalxsds/pom.xml
jaxb2/web-services-spring-jaxb2-globalxsds/src/main/resources/schemas/parent.xsd
jaxb2/web-services-spring-jaxb2-server/pom.xml
jaxb2/web-services-spring-jaxb2-server/src/main/java/de/spring/webservices/endpoints/ExampleEndPoint.java
jaxb2/web-services-spring-jaxb2-server/src/main/java/de/spring/webservices/endpoints/MyCustomMappingExceptionResolver.java
jaxb2/web-services-spring-jaxb2-server/src/main/java/de/spring/webservices/services/ExampleService.java
jaxb2/web-services-spring-jaxb2-server/src/main/java/de/spring/webservices/services/impl/CustomBindingExampleServiceImpl.java
jaxb2/web-services-spring-jaxb2-server/src/main/java/de/spring/webservices/services/impl/ExampleServiceImpl.java
jaxb2/web-services-spring-jaxb2-server/src/main/resources/schemas/examples.xsd
jaxb2/web-services-spring-jaxb2-server/src/main/resources/spring-configuration/ws/soap-ws.xml
jaxb2/web-services-spring-jaxb2-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointTest.java
jaxb2/web-services-spring-jaxb2-server/src/test/java/de/spring/webservices/services/CustomBindingExampleServiceTest.java
jaxb2/web-services-spring-jaxb2-server/src/test/java/de/spring/webservices/services/ExampleServiceTest.java

index 8c2ca58..c3de39a 100644 (file)
                                                        <sourceRoot>${project.wsdl.target.path}</sourceRoot>
                                                        <wsdlOptions>
                                                                <wsdlOption>
-                                                                       <!-- <wsdl>${project.wsdl.sources.path}/example.wsdl</wsdl> -->
                                                                        <wsdl>${project.wsdl.sources.path}/example.wsdl</wsdl>
                                                                        <bindingFiles>
                                                                                <bindingFile>${project.bindings.path}/custombinding.xjb</bindingFile>
index 95e1fd2..38ddbe1 100644 (file)
     jaxb:version="2.1"
     jaxb:extensionBindingPrefixes="xjc inheritance annox">
 
+       <!--
+               Perhaps it would be better to relay on the package generated automatically from WSDL
+               In a real project, I guess, I should use the package generated from WSDL file...
+        -->
     <jaxws:bindings
         node="wsdl:definitions">
-        <jaxws:package name="de.spring.webservices.auto"/>
+        <jaxws:package name="de.spring.webservices.client.auto"/>
     </jaxws:bindings>
     
 
     <jaxws:bindings
         node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://gumartinm.name/spring-ws/example']">
 
+               <!--
+                       Perhaps it would be better to relay on the package generated automatically from WSDL
+                       In a real project, I guess, I should use the package generated from WSDL file...
+               -->
         <jaxb:schemaBindings>
-            <jaxb:package name="de.spring.webservices.auto"/>
+            <jaxb:package name="de.spring.webservices.client.auto"/>
         </jaxb:schemaBindings>
 
         <jaxb:bindings node="//xs:element[@name='CustomBindingExampleRequest']/xs:complextype">
index f0ddf0f..9b3fdaf 100644 (file)
             </xs:all>
         </xs:complexType>
     </xs:element>
-    <xs:element name="ExampleFault">
-       <xs:complexType>
-               <xs:sequence>
-                       <xs:element name="technicalError" type="xs:string"/>
-                       <xs:element maxOccurs="unbounded" minOccurs="0" name="elements" type="parent:element"/>
-               </xs:sequence>
-        </xs:complexType>
-    </xs:element>
+    <xs:element name="ExampleFault" type="parent:generalFault"/>
 
 
        <!-- Using custombinding.xjb instead of inheritance plugin.
             </xs:all>
         </xs:complexType>
     </xs:element>
-    <xs:element name="CustomBindingExampleFault">
-       <xs:complexType>
-               <xs:sequence>
-                       <xs:element name="technicalError" type="xs:string"/>
-                       <xs:element maxOccurs="unbounded" minOccurs="0" name="elements" type="parent:element"/>
-               </xs:sequence>
-        </xs:complexType>
-    </xs:element>
+    <xs:element name="CustomBindingExampleFault" type="parent:generalFault"/>
 
        <!-- Example of creating array list by means of XSD -->
     <xs:complexType name="car">
index 578bcca..c7d9758 100644 (file)
@@ -6,14 +6,14 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.ws.client.core.WebServiceTemplate;
 
-import de.spring.webservices.auto.CustomBindingExampleFault_Exception;
-import de.spring.webservices.auto.CustomBindingExampleRequest;
-import de.spring.webservices.auto.CustomBindingExampleResponse;
-import de.spring.webservices.auto.ExampleFault_Exception;
-import de.spring.webservices.auto.ExampleRequest;
-import de.spring.webservices.auto.ExampleResponse;
-import de.spring.webservices.auto.Examples;
-import de.spring.webservices.auto.ExamplesService;
+import de.spring.webservices.client.auto.CustomBindingExampleFault;
+import de.spring.webservices.client.auto.CustomBindingExampleRequest;
+import de.spring.webservices.client.auto.CustomBindingExampleResponse;
+import de.spring.webservices.client.auto.ExampleFault;
+import de.spring.webservices.client.auto.ExampleRequest;
+import de.spring.webservices.client.auto.ExampleResponse;
+import de.spring.webservices.client.auto.Examples;
+import de.spring.webservices.client.auto.ExamplesService;
 
 /**
  * Someone could write code like this one in order to send and receive
@@ -29,7 +29,7 @@ public class ExampleClientService {
            this.webServiceTemplate = webServiceTemplate;
     }
 
-       public ExampleResponse sendAndReceiveJava() throws ExampleFault_Exception {
+       public ExampleResponse sendAndReceiveJava() throws ExampleFault {
         final ExampleRequest exampleRequest = new ExampleRequest();
         exampleRequest.setData("SCARLETT JAVA. IT IS CANON.");
 
@@ -49,7 +49,7 @@ public class ExampleClientService {
         return exampleResponse;
     }
        
-       public CustomBindingExampleResponse sendAndReceiveJavaCustom() throws CustomBindingExampleFault_Exception {
+       public CustomBindingExampleResponse sendAndReceiveJavaCustom() throws CustomBindingExampleFault {
         final CustomBindingExampleRequest customBindingxampleRequest =
                        new CustomBindingExampleRequest();
         customBindingxampleRequest.setData("CUSTOM BINDING JAVA. SCARLETT. IT IS CANON.");
index c5d8e6f..8527ab5 100644 (file)
@@ -5,10 +5,10 @@ import org.slf4j.LoggerFactory;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-import de.spring.webservices.auto.CustomBindingExampleFault_Exception;
-import de.spring.webservices.auto.CustomBindingExampleResponse;
-import de.spring.webservices.auto.ExampleFault_Exception;
-import de.spring.webservices.auto.ExampleResponse;
+import de.spring.webservices.client.auto.CustomBindingExampleFault;
+import de.spring.webservices.client.auto.CustomBindingExampleResponse;
+import de.spring.webservices.client.auto.ExampleFault;
+import de.spring.webservices.client.auto.ExampleResponse;
 
 /**
  * This class is used just like a nice example about how to write and run client
@@ -25,7 +25,7 @@ public class MainTest {
      * @throws ExampleFault_Exception 
      * @throws CustomBindingExampleFault_Exception 
      */
-    public static void main(final String[] args) throws ExampleFault_Exception, CustomBindingExampleFault_Exception {
+    public static void main(final String[] args) throws ExampleFault, CustomBindingExampleFault {
         final MainTest test = new MainTest();
 
         test.context = new ClassPathXmlApplicationContext(
index e73313a..26cd175 100644 (file)
             </xs:all>
         </xs:complexType>
     </xs:element>
-    <xs:element name="ExampleFault">
-       <xs:complexType>
-               <xs:sequence>
-                       <xs:element name="technicalError" type="xs:string" />
-                       <xs:element name="elements" type="parent:element" minOccurs="0" maxOccurs="unbounded"/>
-               </xs:sequence>
-        </xs:complexType>
-    </xs:element>
+    <xs:element name="ExampleFault" type="parent:generalFault" />
 
 
        <!-- Using custombinding.xjb instead of inheritance plugin.
             </xs:all>
         </xs:complexType>
     </xs:element>
-    <xs:element name="CustomBindingExampleFault">
-       <xs:complexType>
-               <xs:sequence>
-                       <xs:element name="technicalError" type="xs:string" />
-                       <xs:element name="elements" type="parent:element" minOccurs="0" maxOccurs="unbounded"/>
-               </xs:sequence>
-        </xs:complexType>
-    </xs:element>
+    <xs:element name="CustomBindingExampleFault" type="parent:generalFault" />
 
        <!-- Example of creating array list by means of XSD -->
     <xs:complexType name="car">
index b085d95..b701475 100644 (file)
                maven-jaxb2-plugin NO GENERA ESTOS OBJETOS pero maven-jaxb2-plugin NO ES BUENO PARA GENERAR CLASES
                DESDE WSDLs POR LAS RAZONES EXPLICADAS EN EL pom.xml DEL PROYECTO web-services-spring-jaxb2-client.
      -->
-     <oxm:jaxb2-marshaller id="marshaller" context-path="de.spring.webservices.auto"/>
+     <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
+       <!-- 
+               contextPath because of Examples autogenerated class, which is an @Weberservice interface.
+        -->
+       <property name="contextPath" value="de.spring.webservices.client.auto:name.gumartinm.spring_ws.parent"/>
+        </bean>
        
      
    
index a536c47..4877a5d 100644 (file)
@@ -16,8 +16,8 @@ import org.springframework.ws.client.core.WebServiceTemplate;
 import org.springframework.ws.test.client.MockWebServiceServer;
 import org.springframework.xml.transform.StringSource;
 
-import de.spring.webservices.auto.CustomBindingExampleResponse;
-import de.spring.webservices.auto.ExampleResponse;
+import de.spring.webservices.client.auto.CustomBindingExampleResponse;
+import de.spring.webservices.client.auto.ExampleResponse;
 
 
 @RunWith(SpringJUnit4ClassRunner.class)
index 691a780..ef09daf 100644 (file)
@@ -13,7 +13,7 @@
        <properties>
                <project.xsd.schemas.source.path>src/main/resources</project.xsd.schemas.source.path>
                <project.xsd.schemas.target.path>${basedir}/target/generated-sources/src/main/java</project.xsd.schemas.target.path>
-               <project.xsd.schemas.package.name>de.spring.webservices.auto</project.xsd.schemas.package.name>
+               <project.xsd.schemas.package.name>de.spring.webservices.parent.auto</project.xsd.schemas.package.name>
                <project.bindings.path>src/main/build-resources/bindings</project.bindings.path>
        </properties>
 
index 46f6550..c5801a6 100644 (file)
             <xs:element name="messageArgs" type="xs:string" minOccurs="0" maxOccurs="100"/>
         </xs:sequence>
     </xs:complexType>
+    
+    <xs:complexType name="generalFault">
+        <xs:sequence>
+               <xs:element name="technicalError" type="xs:string" />
+               <xs:element name="elements" type="parent:element" minOccurs="0" maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
 
 </xs:schema>
index d9fa313..1038489 100644 (file)
@@ -15,7 +15,7 @@
                <jetty.version>9.3.0.RC0</jetty.version>
                <project.xsd.schemas.source.path>src/main/resources</project.xsd.schemas.source.path>
                <project.xsd.schemas.target.path>${basedir}/target/generated-sources/src/main/java</project.xsd.schemas.target.path>
-               <project.xsd.schemas.package.name>de.spring.webservices.auto</project.xsd.schemas.package.name>
+               <project.xsd.schemas.package.name>de.spring.webservices.server.auto</project.xsd.schemas.package.name>
                <project.bindings.path>src/main/build-resources/bindings</project.bindings.path>
                <!-- Requires absolute path (because of that I am using ${basedir} -->
                <project.catalogs.path>${basedir}/src/main/build-resources/catalogs</project.catalogs.path>
index 8fb4e40..e3e8da6 100644 (file)
@@ -8,12 +8,12 @@ import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
 import org.springframework.ws.server.endpoint.annotation.RequestPayload;
 import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
 
-import de.spring.webservices.auto.CustomBindingExampleRequest;
-import de.spring.webservices.auto.CustomBindingExampleResponse;
-import de.spring.webservices.auto.ExampleRequest;
-import de.spring.webservices.auto.ExampleResponse;
 import de.spring.webservices.operations.Operations;
 import de.spring.webservices.operations.Operations.RequestResponse;
+import de.spring.webservices.server.auto.CustomBindingExampleRequest;
+import de.spring.webservices.server.auto.CustomBindingExampleResponse;
+import de.spring.webservices.server.auto.ExampleRequest;
+import de.spring.webservices.server.auto.ExampleResponse;
 import de.spring.webservices.services.ExampleService;
 
 
index f07d42e..9d05061 100644 (file)
@@ -19,9 +19,9 @@ import org.springframework.ws.soap.server.endpoint.AbstractSoapFaultDefinitionEx
 import org.springframework.ws.soap.server.endpoint.SoapFaultDefinition;
 import org.springframework.ws.soap.server.endpoint.SoapFaultDefinitionEditor;
 
-import de.spring.webservices.auto.Element;
-import de.spring.webservices.auto.ExampleFault;
 import de.spring.webservices.exceptions.CustomBusinessException;
+import de.spring.webservices.server.auto.Element;
+import de.spring.webservices.server.auto.GeneralFault;
 
 public class MyCustomMappingExceptionResolver extends AbstractSoapFaultDefinitionExceptionResolver {
        private static final Logger LOGGER = LoggerFactory.getLogger(MyCustomMappingExceptionResolver.class);
@@ -94,7 +94,7 @@ public class MyCustomMappingExceptionResolver extends AbstractSoapFaultDefinitio
        }
 
        protected void customizeFault(Object endpoint, Exception ex, SoapFault fault) {
-               ExampleFault customFault = new ExampleFault();
+               GeneralFault customFault = new GeneralFault();
                customFault.setTechnicalError(getStackTrace(ex));
                
                Element element = buildElement(ex);
index 9d7eb79..881be73 100644 (file)
@@ -1,7 +1,7 @@
 package de.spring.webservices.services;
 
-import de.spring.webservices.auto.ExampleRequest;
-import de.spring.webservices.auto.ExampleResponse;
+import de.spring.webservices.server.auto.ExampleRequest;
+import de.spring.webservices.server.auto.ExampleResponse;
 
 
 public interface ExampleService {
index 9863bae..0247a3f 100644 (file)
@@ -5,14 +5,12 @@ package de.spring.webservices.services.impl;
 
 import org.springframework.stereotype.Service;
 
-
-
+import de.spring.webservices.operations.Operations;
+import de.spring.webservices.server.auto.CustomBindingExampleRequest;
+import de.spring.webservices.server.auto.CustomBindingExampleResponse;
+import de.spring.webservices.server.auto.ParentEnumType;
 //import de.spring.webservices.exceptions.BusinessException;
 //import de.spring.webservices.exceptions.CustomBusinessException;
-import de.spring.webservices.auto.CustomBindingExampleRequest;
-import de.spring.webservices.auto.CustomBindingExampleResponse;
-import de.spring.webservices.auto.ParentEnumType;
-import de.spring.webservices.operations.Operations;
 
 
 @Service("customBindingExampleService")
index 7037776..ec80b60 100644 (file)
@@ -2,8 +2,8 @@ package de.spring.webservices.services.impl;
 
 import org.springframework.stereotype.Service;
 
-import de.spring.webservices.auto.ExampleRequest;
-import de.spring.webservices.auto.ExampleResponse;
+import de.spring.webservices.server.auto.ExampleRequest;
+import de.spring.webservices.server.auto.ExampleResponse;
 import de.spring.webservices.services.ExampleService;
 
 
index e73313a..26cd175 100644 (file)
             </xs:all>
         </xs:complexType>
     </xs:element>
-    <xs:element name="ExampleFault">
-       <xs:complexType>
-               <xs:sequence>
-                       <xs:element name="technicalError" type="xs:string" />
-                       <xs:element name="elements" type="parent:element" minOccurs="0" maxOccurs="unbounded"/>
-               </xs:sequence>
-        </xs:complexType>
-    </xs:element>
+    <xs:element name="ExampleFault" type="parent:generalFault" />
 
 
        <!-- Using custombinding.xjb instead of inheritance plugin.
             </xs:all>
         </xs:complexType>
     </xs:element>
-    <xs:element name="CustomBindingExampleFault">
-       <xs:complexType>
-               <xs:sequence>
-                       <xs:element name="technicalError" type="xs:string" />
-                       <xs:element name="elements" type="parent:element" minOccurs="0" maxOccurs="unbounded"/>
-               </xs:sequence>
-        </xs:complexType>
-    </xs:element>
+    <xs:element name="CustomBindingExampleFault" type="parent:generalFault" />
 
        <!-- Example of creating array list by means of XSD -->
     <xs:complexType name="car">
index 6dd10fc..dba53c4 100644 (file)
@@ -29,7 +29,7 @@
         2. Especificando el context-path para ser escaneado por Spring usando anotaciones. Esto
         se hace de este modo:
         
-        <oxm:jaxb2-marshaller id="marshaller" context-path="de.spring.webservices.auto"/>
+        <oxm:jaxb2-marshaller id="marshaller" context-path="de.spring.webservices.server.auto"/>
         Esto es lo mismo que haría Spring si no declaramos nada en el XML pero así tenemos opción de
         de especificar un context-path en concreto.
         
        en globalxsds (quizás incluso basado en el namespace del xsd) y así podría evitar esta configuración.
      -->
     <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
-       <property name="packagesToScan" value="de.spring.webservices.auto"/>
+       <!--
+               cxf-xjc-plugin generates again the objects in web-services-spring-cxf-globalxsds :(
+               So we MAY NOT scan everything because there is more than one class representing
+               the same XML element. :(
+       -->
+       <property name="packagesToScan" value="de.spring.webservices.server.auto"/>
        </bean>
        <!-- Searches for @PayloadRoot -->
     <sws:annotation-driven marshaller="marshaller" unmarshaller="marshaller" />
index 5b04c2f..a4a279f 100644 (file)
@@ -6,10 +6,10 @@ import static org.mockito.Mockito.verify;
 import org.junit.Before;
 import org.junit.Test;
 
-import de.spring.webservices.auto.CustomBindingExampleRequest;
-import de.spring.webservices.auto.CustomBindingExampleResponse;
-import de.spring.webservices.auto.ExampleRequest;
 import de.spring.webservices.operations.Operations;
+import de.spring.webservices.server.auto.CustomBindingExampleRequest;
+import de.spring.webservices.server.auto.CustomBindingExampleResponse;
+import de.spring.webservices.server.auto.ExampleRequest;
 import de.spring.webservices.services.ExampleService;
 
 
index a6d493b..d3b56be 100644 (file)
@@ -4,9 +4,9 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-import de.spring.webservices.auto.CustomBindingExampleRequest;
-import de.spring.webservices.auto.CustomBindingExampleResponse;
 import de.spring.webservices.operations.Operations;
+import de.spring.webservices.server.auto.CustomBindingExampleRequest;
+import de.spring.webservices.server.auto.CustomBindingExampleResponse;
 import de.spring.webservices.services.impl.CustomBindingExampleServiceImpl;
 
 
index 493c76d..9f33c5e 100644 (file)
@@ -4,8 +4,8 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-import de.spring.webservices.auto.ExampleRequest;
-import de.spring.webservices.auto.ExampleResponse;
+import de.spring.webservices.server.auto.ExampleRequest;
+import de.spring.webservices.server.auto.ExampleResponse;
 import de.spring.webservices.services.impl.ExampleServiceImpl;
 
 public class ExampleServiceTest {
index ca1f3f8..9bd8253 100644 (file)
@@ -13,7 +13,7 @@
        <properties>
                <project.xsd.schemas.source.path>src/main/build-resources/wsdl</project.xsd.schemas.source.path>
                <project.xsd.schemas.target.path>${project.build.directory}/generated-sources/src/main/java</project.xsd.schemas.target.path>
-               <project.xsd.schemas.package.name>de.spring.webservices.auto</project.xsd.schemas.package.name>
+               <project.xsd.schemas.package.name>de.spring.webservices.client.auto</project.xsd.schemas.package.name>
                <project.bindings.path>src/main/build-resources/bindings</project.bindings.path>
        </properties>
 
index 368eb3b..374ed46 100644 (file)
             </xs:all>
         </xs:complexType>
     </xs:element>
-    <xs:element name="ExampleFault">
-       <xs:complexType>
-               <xs:sequence>
-                       <xs:element name="technicalError" type="xs:string"/>
-                       <xs:element maxOccurs="unbounded" minOccurs="0" name="elements" type="parent:element"/>
-               </xs:sequence>
-        </xs:complexType>
-    </xs:element>
+    <xs:element name="ExampleFault" type="parent:generalFault"/>
 
 
        <!-- Using custombinding.xjb instead of inheritance plugin.
             </xs:all>
         </xs:complexType>
     </xs:element>
-    <xs:element name="CustomBindingExampleFault">
-       <xs:complexType>
-               <xs:sequence>
-                       <xs:element name="technicalError" type="xs:string"/>
-                       <xs:element maxOccurs="unbounded" minOccurs="0" name="elements" type="parent:element"/>
-               </xs:sequence>
-        </xs:complexType>
-    </xs:element>
+    <xs:element name="CustomBindingExampleFault" type="parent:generalFault"/>
 
        <!-- Example of creating array list by means of XSD -->
     <xs:complexType name="car">
index 25179d9..f8bad46 100644 (file)
@@ -4,13 +4,13 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.ws.client.core.WebServiceTemplate;
 
-import de.spring.webservices.auto.CustomBindingExampleRequest;
-import de.spring.webservices.auto.CustomBindingExampleResponse;
-import de.spring.webservices.auto.ExampleRequest;
-import de.spring.webservices.auto.ExampleResponse;
-//import de.spring.webservices.auto.Examples;
-//import de.spring.webservices.auto.ExamplesService;
-//import de.spring.webservices.auto.ParentEnumType;
+import de.spring.webservices.client.auto.CustomBindingExampleRequest;
+import de.spring.webservices.client.auto.CustomBindingExampleResponse;
+import de.spring.webservices.client.auto.ExampleRequest;
+import de.spring.webservices.client.auto.ExampleResponse;
+//import de.spring.webservices.client.auto.Examples;
+//import de.spring.webservices.client.auto.ExamplesService;
+//import de.spring.webservices.client.auto.ParentEnumType;
 
 /**
  * Someone could write code like this one in order to send and receive
index 36f5de4..8d79220 100644 (file)
@@ -5,8 +5,8 @@ import org.slf4j.LoggerFactory;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-import de.spring.webservices.auto.CustomBindingExampleResponse;
-import de.spring.webservices.auto.ExampleResponse;
+import de.spring.webservices.client.auto.CustomBindingExampleResponse;
+import de.spring.webservices.client.auto.ExampleResponse;
 
 /**
  * This class is used just like a nice example about how to write and run client
index e73313a..26cd175 100644 (file)
             </xs:all>
         </xs:complexType>
     </xs:element>
-    <xs:element name="ExampleFault">
-       <xs:complexType>
-               <xs:sequence>
-                       <xs:element name="technicalError" type="xs:string" />
-                       <xs:element name="elements" type="parent:element" minOccurs="0" maxOccurs="unbounded"/>
-               </xs:sequence>
-        </xs:complexType>
-    </xs:element>
+    <xs:element name="ExampleFault" type="parent:generalFault" />
 
 
        <!-- Using custombinding.xjb instead of inheritance plugin.
             </xs:all>
         </xs:complexType>
     </xs:element>
-    <xs:element name="CustomBindingExampleFault">
-       <xs:complexType>
-               <xs:sequence>
-                       <xs:element name="technicalError" type="xs:string" />
-                       <xs:element name="elements" type="parent:element" minOccurs="0" maxOccurs="unbounded"/>
-               </xs:sequence>
-        </xs:complexType>
-    </xs:element>
+    <xs:element name="CustomBindingExampleFault" type="parent:generalFault" />
 
        <!-- Example of creating array list by means of XSD -->
     <xs:complexType name="car">
index 985c5ad..cd67e3e 100644 (file)
        en globalxsds (quizás incluso basado en el namespace del xsd) y así podría evitar esta configuración. 
      -->
        <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
-       <property name="packagesToScan" value="de.spring.webservices.auto"/>
+       <!--
+               maven-jaxb2-plugin for WSDL DOES generate again the objects in web-services-spring-jaxb2-globalxsds :(
+               So we MAY NOT scan everything because there is more than one class representing
+               the same XML element. :(
+       -->
+       <property name="packagesToScan" value="de.spring.webservices.client.auto"/>
        </bean>
      
    
index a536c47..4877a5d 100644 (file)
@@ -16,8 +16,8 @@ import org.springframework.ws.client.core.WebServiceTemplate;
 import org.springframework.ws.test.client.MockWebServiceServer;
 import org.springframework.xml.transform.StringSource;
 
-import de.spring.webservices.auto.CustomBindingExampleResponse;
-import de.spring.webservices.auto.ExampleResponse;
+import de.spring.webservices.client.auto.CustomBindingExampleResponse;
+import de.spring.webservices.client.auto.ExampleResponse;
 
 
 @RunWith(SpringJUnit4ClassRunner.class)
index b577d57..35278a9 100644 (file)
@@ -13,7 +13,7 @@
        <properties>
                <project.xsd.schemas.source.path>src/main/resources/schemas</project.xsd.schemas.source.path>
                <project.xsd.schemas.target.path>${project.build.directory}/generated-sources/src/main/java</project.xsd.schemas.target.path>
-               <project.xsd.schemas.package.name>de.spring.webservices.auto</project.xsd.schemas.package.name>
+               <project.xsd.schemas.package.name>de.spring.webservices.parent.auto</project.xsd.schemas.package.name>
                <project.bindings.path>src/main/build-resources/bindings</project.bindings.path>
        </properties>
 
index 46f6550..c5801a6 100644 (file)
             <xs:element name="messageArgs" type="xs:string" minOccurs="0" maxOccurs="100"/>
         </xs:sequence>
     </xs:complexType>
+    
+    <xs:complexType name="generalFault">
+        <xs:sequence>
+               <xs:element name="technicalError" type="xs:string" />
+               <xs:element name="elements" type="parent:element" minOccurs="0" maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
 
 </xs:schema>
index 6f44f97..fd5de7c 100644 (file)
@@ -15,7 +15,7 @@
                <jetty.version>9.3.0.RC0</jetty.version>
                <project.xsd.schemas.source.path>src/main/resources/schemas</project.xsd.schemas.source.path>
                <project.xsd.schemas.target.path>${project.build.directory}/generated-sources/src/main/java</project.xsd.schemas.target.path>
-               <project.xsd.schemas.package.name>de.spring.webservices.auto</project.xsd.schemas.package.name>
+               <project.xsd.schemas.package.name>de.spring.webservices.server.auto</project.xsd.schemas.package.name>
                <project.bindings.path>src/main/build-resources/bindings</project.bindings.path>
        </properties>
 
index 8fb4e40..e3e8da6 100644 (file)
@@ -8,12 +8,12 @@ import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
 import org.springframework.ws.server.endpoint.annotation.RequestPayload;
 import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
 
-import de.spring.webservices.auto.CustomBindingExampleRequest;
-import de.spring.webservices.auto.CustomBindingExampleResponse;
-import de.spring.webservices.auto.ExampleRequest;
-import de.spring.webservices.auto.ExampleResponse;
 import de.spring.webservices.operations.Operations;
 import de.spring.webservices.operations.Operations.RequestResponse;
+import de.spring.webservices.server.auto.CustomBindingExampleRequest;
+import de.spring.webservices.server.auto.CustomBindingExampleResponse;
+import de.spring.webservices.server.auto.ExampleRequest;
+import de.spring.webservices.server.auto.ExampleResponse;
 import de.spring.webservices.services.ExampleService;
 
 
index f07d42e..382cd74 100644 (file)
@@ -19,9 +19,9 @@ import org.springframework.ws.soap.server.endpoint.AbstractSoapFaultDefinitionEx
 import org.springframework.ws.soap.server.endpoint.SoapFaultDefinition;
 import org.springframework.ws.soap.server.endpoint.SoapFaultDefinitionEditor;
 
-import de.spring.webservices.auto.Element;
-import de.spring.webservices.auto.ExampleFault;
 import de.spring.webservices.exceptions.CustomBusinessException;
+import de.spring.webservices.parent.auto.Element;
+import de.spring.webservices.parent.auto.GeneralFault;
 
 public class MyCustomMappingExceptionResolver extends AbstractSoapFaultDefinitionExceptionResolver {
        private static final Logger LOGGER = LoggerFactory.getLogger(MyCustomMappingExceptionResolver.class);
@@ -94,7 +94,7 @@ public class MyCustomMappingExceptionResolver extends AbstractSoapFaultDefinitio
        }
 
        protected void customizeFault(Object endpoint, Exception ex, SoapFault fault) {
-               ExampleFault customFault = new ExampleFault();
+               GeneralFault customFault = new GeneralFault();
                customFault.setTechnicalError(getStackTrace(ex));
                
                Element element = buildElement(ex);
index 9d7eb79..881be73 100644 (file)
@@ -1,7 +1,7 @@
 package de.spring.webservices.services;
 
-import de.spring.webservices.auto.ExampleRequest;
-import de.spring.webservices.auto.ExampleResponse;
+import de.spring.webservices.server.auto.ExampleRequest;
+import de.spring.webservices.server.auto.ExampleResponse;
 
 
 public interface ExampleService {
index 9863bae..88424b2 100644 (file)
@@ -5,14 +5,12 @@ package de.spring.webservices.services.impl;
 
 import org.springframework.stereotype.Service;
 
-
-
+import de.spring.webservices.operations.Operations;
+import de.spring.webservices.parent.auto.ParentEnumType;
+import de.spring.webservices.server.auto.CustomBindingExampleRequest;
+import de.spring.webservices.server.auto.CustomBindingExampleResponse;
 //import de.spring.webservices.exceptions.BusinessException;
 //import de.spring.webservices.exceptions.CustomBusinessException;
-import de.spring.webservices.auto.CustomBindingExampleRequest;
-import de.spring.webservices.auto.CustomBindingExampleResponse;
-import de.spring.webservices.auto.ParentEnumType;
-import de.spring.webservices.operations.Operations;
 
 
 @Service("customBindingExampleService")
index 7037776..ec80b60 100644 (file)
@@ -2,8 +2,8 @@ package de.spring.webservices.services.impl;
 
 import org.springframework.stereotype.Service;
 
-import de.spring.webservices.auto.ExampleRequest;
-import de.spring.webservices.auto.ExampleResponse;
+import de.spring.webservices.server.auto.ExampleRequest;
+import de.spring.webservices.server.auto.ExampleResponse;
 import de.spring.webservices.services.ExampleService;
 
 
index e73313a..26cd175 100644 (file)
             </xs:all>
         </xs:complexType>
     </xs:element>
-    <xs:element name="ExampleFault">
-       <xs:complexType>
-               <xs:sequence>
-                       <xs:element name="technicalError" type="xs:string" />
-                       <xs:element name="elements" type="parent:element" minOccurs="0" maxOccurs="unbounded"/>
-               </xs:sequence>
-        </xs:complexType>
-    </xs:element>
+    <xs:element name="ExampleFault" type="parent:generalFault" />
 
 
        <!-- Using custombinding.xjb instead of inheritance plugin.
             </xs:all>
         </xs:complexType>
     </xs:element>
-    <xs:element name="CustomBindingExampleFault">
-       <xs:complexType>
-               <xs:sequence>
-                       <xs:element name="technicalError" type="xs:string" />
-                       <xs:element name="elements" type="parent:element" minOccurs="0" maxOccurs="unbounded"/>
-               </xs:sequence>
-        </xs:complexType>
-    </xs:element>
+    <xs:element name="CustomBindingExampleFault" type="parent:generalFault" />
 
        <!-- Example of creating array list by means of XSD -->
     <xs:complexType name="car">
index d3b562b..601b57b 100644 (file)
@@ -29,7 +29,7 @@
         2. Especificando el context-path para ser escaneado por Spring usando anotaciones. Esto
         se hace de este modo:
         
-        <oxm:jaxb2-marshaller id="marshaller" context-path="de.spring.webservices.auto"/>
+        <oxm:jaxb2-marshaller id="marshaller" context-path="de.spring.webservices.server.auto"/>
         Esto es lo mismo que haría Spring si no declaramos nada en el XML pero así tenemos opción de
         de especificar un context-path en concreto.
         
        en globalxsds (quizás incluso basado en el namespace del xsd) y así podría evitar esta configuración.
      -->
     <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
-       <property name="packagesToScan" value="de.spring.webservices.auto"/>
+       <!--
+               maven-jaxb2-plugin does NOT generate again the objects in web-services-spring-jaxb2-globalxsds
+               So we MAY scan everything and there is no trouble because there is not more than one class representing
+               the same XML element.
+       -->
+       <property name="packagesToScan" value="de.spring.webservices"/>
        </bean>
        <!-- Searches for @PayloadRoot -->
     <sws:annotation-driven marshaller="marshaller" unmarshaller="marshaller" />
index 5b04c2f..a4a279f 100644 (file)
@@ -6,10 +6,10 @@ import static org.mockito.Mockito.verify;
 import org.junit.Before;
 import org.junit.Test;
 
-import de.spring.webservices.auto.CustomBindingExampleRequest;
-import de.spring.webservices.auto.CustomBindingExampleResponse;
-import de.spring.webservices.auto.ExampleRequest;
 import de.spring.webservices.operations.Operations;
+import de.spring.webservices.server.auto.CustomBindingExampleRequest;
+import de.spring.webservices.server.auto.CustomBindingExampleResponse;
+import de.spring.webservices.server.auto.ExampleRequest;
 import de.spring.webservices.services.ExampleService;
 
 
index a6d493b..d3b56be 100644 (file)
@@ -4,9 +4,9 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-import de.spring.webservices.auto.CustomBindingExampleRequest;
-import de.spring.webservices.auto.CustomBindingExampleResponse;
 import de.spring.webservices.operations.Operations;
+import de.spring.webservices.server.auto.CustomBindingExampleRequest;
+import de.spring.webservices.server.auto.CustomBindingExampleResponse;
 import de.spring.webservices.services.impl.CustomBindingExampleServiceImpl;
 
 
index 493c76d..9f33c5e 100644 (file)
@@ -4,8 +4,8 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-import de.spring.webservices.auto.ExampleRequest;
-import de.spring.webservices.auto.ExampleResponse;
+import de.spring.webservices.server.auto.ExampleRequest;
+import de.spring.webservices.server.auto.ExampleResponse;
 import de.spring.webservices.services.impl.ExampleServiceImpl;
 
 public class ExampleServiceTest {