client integration tests, client custom bindings
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 7 Jun 2015 23:20:42 +0000 (01:20 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 7 Jun 2015 23:31:53 +0000 (01:31 +0200)
29 files changed:
README.md
web-services-spring-client/pom.xml
web-services-spring-client/src/main/build-resources/bindings/custombinding.xjb [new file with mode: 0644]
web-services-spring-client/src/main/build-resources/catalog.cat [deleted file]
web-services-spring-client/src/main/build-resources/catalogs/catalog.cat [new file with mode: 0644]
web-services-spring-client/src/main/build-resources/wsdl/example.wsdl [new file with mode: 0644]
web-services-spring-client/src/main/java/de/spring/webservices/client/ExampleClientService.java
web-services-spring-client/src/main/java/de/spring/webservices/client/MainTest.java
web-services-spring-client/src/main/java/de/spring/webservices/operations/Operations.java [deleted file]
web-services-spring-client/src/main/java/de/spring/webservices/operations/Request.java [deleted file]
web-services-spring-client/src/main/java/de/spring/webservices/operations/Response.java [deleted file]
web-services-spring-client/src/main/resources/bindings/custombinding.xjb [deleted file]
web-services-spring-client/src/main/resources/examples.xsd [new file with mode: 0644]
web-services-spring-client/src/main/resources/log4j2.xml [new file with mode: 0644]
web-services-spring-client/src/main/resources/spring-configuration/client-spring-configuration.xml [deleted file]
web-services-spring-client/src/main/resources/spring-configuration/ws/client-spring-configuration.xml [new file with mode: 0644]
web-services-spring-client/src/main/resources/wsdl/example.wsdl [deleted file]
web-services-spring-client/src/main/resources/xsd/examples.xsd [deleted file]
web-services-spring-client/src/test/java/de/spring/webservices/client/ExampleClientServiceIntegrationTest.java
web-services-spring-globalxsds/src/main/java/de/spring/webservices/binders/XSDateTimeCustomBinder.java [new file with mode: 0644]
web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Operations.java [new file with mode: 0644]
web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Request.java [new file with mode: 0644]
web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Response.java [new file with mode: 0644]
web-services-spring-server/src/main/java/de/spring/webservices/binders/XSDateTimeCustomBinder.java [deleted file]
web-services-spring-server/src/main/java/de/spring/webservices/operations/Operations.java [deleted file]
web-services-spring-server/src/main/java/de/spring/webservices/operations/Request.java [deleted file]
web-services-spring-server/src/main/java/de/spring/webservices/operations/Response.java [deleted file]
web-services-spring-server/src/main/resources/examples.xsd
web-services-spring-server/src/main/resources/spring-configuration/ws/soap-ws.xml

index 9fe3e8b..bdea049 100644 (file)
--- a/README.md
+++ b/README.md
@@ -12,9 +12,7 @@ mvn clean install -Dmaven.test.skip=true
 
 TODO: maven-jaxb2-plugin in order to reuse generated Java code from other projects (cxf-xjc-plugin doesn't implement such feature
 without generating episodes by myself)
-TODO: custom bindings when creating Java code from wsdl.
 TODO: using Jetty instead of Tomcat
 TODO: logging Spring information
-TODO: integration tests (client and server)
 
 For debugging: export MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"
index 4ba6e18..29e7648 100644 (file)
   <url>http://gumartinm.name</url>
 
   <properties>
-    <project.wsdl.sources.path>src/main/resources/wsdl</project.wsdl.sources.path>
+    <project.wsdl.sources.path>src/main/build-resources/wsdl</project.wsdl.sources.path>
     <project.wsdl.target.path>${basedir}/target/generated-sources/src/main/java</project.wsdl.target.path>
-    <project.bindings.path>src/main/resources/bindings</project.bindings.path> 
+    <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>
   </properties>
 
   <dependencies>
         <artifactId>jdom</artifactId>
     </dependency>
 
+
+    <!-- Global types -->
+    <dependency>
+        <groupId>de.spring.webservices</groupId>
+        <artifactId>web-services-spring-globalxsds</artifactId>
+        <version>${project.version}</version>
+    </dependency>
+
+
     <!-- Required by spring-ws-core -->
     <dependency>
         <groupId>wsdl4j</groupId>
                         <goal>wsdl2java</goal>
                     </goals>
                     <configuration>
+                        <fork>true</fork>
                         <sourceRoot>${project.wsdl.target.path}</sourceRoot>
                         <wsdlOptions>
                             <wsdlOption>
                                 <extraargs>
                                     <extraarg>-xjc-Xinheritance</extraarg>
                                     <extraarg>-xjc-Xannotate</extraarg>
+                                    <extraarg>-catalog</extraarg>
+                                    <extraarg>${project.catalogs.path}/catalog.cat</extraarg>
                                     <extraarg>-verbose</extraarg>
                                 </extraargs>
                             </wsdlOption>
diff --git a/web-services-spring-client/src/main/build-resources/bindings/custombinding.xjb b/web-services-spring-client/src/main/build-resources/bindings/custombinding.xjb
new file mode 100644 (file)
index 0000000..95e1fd2
--- /dev/null
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<jaxws:bindings
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
+    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
+    xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
+    xmlns:annox="http://annox.dev.java.net"
+    jaxb:version="2.1"
+    jaxb:extensionBindingPrefixes="xjc inheritance annox">
+
+    <jaxws:bindings
+        node="wsdl:definitions">
+        <jaxws:package name="de.spring.webservices.auto"/>
+    </jaxws:bindings>
+    
+
+    <!--
+        XSD namespace for included schema in WSDL: http://gumartinm.name/spring-ws/example
+
+        I am skiping the XSD namespace for imported schema in WSDL: http://gumartinm.name/spring-ws/parent because I guess,
+        there must be some way of using the already generated code in web-services-spring-globalxsds instead of generating new one
+        (perhaps using maven-jaxb2-plugin with episodes)
+     -->
+    <jaxws:bindings
+        node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://gumartinm.name/spring-ws/example']">
+
+        <jaxb:schemaBindings>
+            <jaxb:package name="de.spring.webservices.auto"/>
+        </jaxb:schemaBindings>
+
+        <jaxb:bindings node="//xs:element[@name='CustomBindingExampleRequest']/xs:complextype">
+            <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements>
+            <annox:annotate>@java.lang.suppresswarnings({"unchecked","rawtypes"})</annox:annotate>
+        </jaxb:bindings>
+
+        <jaxb:bindings node="//xs:element[@name='CustomBindingExampleResponse']/xs:complextype">
+            <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements>
+            <annox:annotate>@java.lang.suppresswarnings({"unchecked","rawtypes"})</annox:annotate>
+        </jaxb:bindings>
+
+        <jaxb:globalBindings>
+            <xjc:javaType adapter="de.spring.webservices.binders.XSDateTimeCustomBinder"
+                name="java.util.Date" xmlType="xs:dateTime" />
+        </jaxb:globalBindings>
+
+    </jaxws:bindings>
+
+</jaxws:bindings>
diff --git a/web-services-spring-client/src/main/build-resources/catalog.cat b/web-services-spring-client/src/main/build-resources/catalog.cat
deleted file mode 100644 (file)
index 82fe4bb..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE catalog
-  PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
-         "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
-<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
-         prefer="public">
-
-<!-- prefer="uri" -->
-
-    <rewriteURI uriStartString="http://gumartinm.name/spring-ws/parent/"
-                rewritePrefix="classpath:/"/>
-
-    <rewriteSystem systemIdStartString="http://gumartinm.name/spring-ws/parent/" rewritePrefix="classpath:/"/>
-</catalog>
diff --git a/web-services-spring-client/src/main/build-resources/catalogs/catalog.cat b/web-services-spring-client/src/main/build-resources/catalogs/catalog.cat
new file mode 100644 (file)
index 0000000..4bc1c66
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system|public" >
+
+   <!--
+        An XML catalog will allow us to specify real locations for our imported XML schemas.
+        The XJC tool supports several different XML Catalog formats:  TR9401, XCatalog, OASIS XML Catalog.
+        I am using OASIS XML Catalog Format
+        
+        OASIS XML Catalog Format: https://www.oasis-open.org/committees/entity/specs/cs-entity-xml-catalogs-1.0.html
+        TR9401: https://www.oasis-open.org/specs/a401.htm
+
+
+        See: http://labs.bsb.com/2011/01/usage-of-an-xml-catalog-in-the-xmlbeans-cxf-integration/
+             http://cxf.apache.org/cxf-xjc-plugin.html 
+             https://jaxb.java.net/2.2.4/docs/catalog.html
+    -->
+
+
+    <!-- I JUST NEED THIS CONFIGURATION, ANYHOW I AM WRITING ALL OF THEM -->
+    <rewriteSystem systemIdStartString="http://gumartinm.name/spring-ws/parent"
+                   rewritePrefix="classpath:parent.xsd"/>
+
+
+    <!-- THE FOLLOWING ONES ARE NOT REQUIRED EVEN IF I AM WRITING THEM -->
+    <public
+        publicId="http://gumartinm.name/spring-ws/parent"
+        uri="classpath:parent.xsd"/>
+
+
+    <system
+        systemId="http://gumartinm.name/spring-ws/parent/parent.xsd"
+        uri="classpath:parent.xsd"/>
+
+
+    <rewriteURI uriStartString="http://gumartinm.name/spring-ws/parent"
+                rewritePrefix="classpath:parent.xsd"/>
+
+</catalog>
diff --git a/web-services-spring-client/src/main/build-resources/wsdl/example.wsdl b/web-services-spring-client/src/main/build-resources/wsdl/example.wsdl
new file mode 100644 (file)
index 0000000..32d94de
--- /dev/null
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://gumartinm.name/spring-ws/example" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://gumartinm.name/resource/wsdl/schemas" targetNamespace="http://gumartinm.name/resource/wsdl/schemas">
+  <wsdl:types>
+    <xs:schema xmlns:annox="http://annox.dev.java.net" xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:parent="http://gumartinm.name/spring-ws/parent" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" jaxb:extensionBindingPrefixes="inheritance annox" jaxb:version="2.1" targetNamespace="http://gumartinm.name/spring-ws/example">
+
+    <!--
+        We are going to use catalog.cat in order to avoid downloading parent.xsd from remote server
+    -->
+    <xs:import namespace="http://gumartinm.name/spring-ws/parent" schemaLocation="http://gumartinm.name/spring-ws/parent/parent.xsd"/>
+
+
+       <!-- Using inheritance and annox plugin -->
+       <xs:element name="ExampleRequest">
+          <xs:complexType>
+              <xs:annotation>
+                <xs:appinfo>
+                    <annox:annotate>@java.lang.SuppressWarnings({"unchecked","rawtypes"})</annox:annotate> 
+                    <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements>
+                </xs:appinfo>
+            </xs:annotation>   
+            <xs:all>
+                <xs:element name="data" type="xs:string"/>
+            </xs:all>
+        </xs:complexType>
+       </xs:element>
+    <xs:element name="ExampleResponse">
+        <xs:complexType>
+        <xs:annotation>
+                <xs:appinfo>
+                    <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements>
+                </xs:appinfo>
+            </xs:annotation>  
+            <xs:all>
+                <xs:element name="data" type="xs:string"/>
+            </xs:all>
+        </xs:complexType>
+    </xs:element>
+
+
+       <!-- Using custombinding.xjb instead of inheritance plugin.
+                Useful when you can not modify your xsd files because they are provided
+                by another person or company
+       -->
+    <xs:element name="CustomBindingExampleRequest">
+          <xs:complexType>
+            <xs:all>
+                <xs:element name="data" type="xs:string"/>
+                <xs:element maxOccurs="1" minOccurs="0" name="exampleDate" type="xs:dateTime"/>
+                <xs:element maxOccurs="1" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/>
+            </xs:all>
+        </xs:complexType>
+       </xs:element>
+    <xs:element name="CustomBindingExampleResponse">
+        <xs:complexType>
+            <xs:all>
+                <xs:element name="data" type="xs:string"/>
+                <xs:element maxOccurs="1" minOccurs="0" name="exampleDate" type="xs:dateTime"/>
+                <xs:element maxOccurs="1" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/>
+            </xs:all>
+        </xs:complexType>
+    </xs:element>
+
+
+</xs:schema>
+  </wsdl:types>
+  <wsdl:message name="CustomBindingExampleRequest">
+    <wsdl:part element="sch:CustomBindingExampleRequest" name="CustomBindingExampleRequest">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="ExampleRequest">
+    <wsdl:part element="sch:ExampleRequest" name="ExampleRequest">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="ExampleResponse">
+    <wsdl:part element="sch:ExampleResponse" name="ExampleResponse">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="CustomBindingExampleResponse">
+    <wsdl:part element="sch:CustomBindingExampleResponse" name="CustomBindingExampleResponse">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="Examples">
+    <wsdl:operation name="CustomBindingExample">
+      <wsdl:input message="tns:CustomBindingExampleRequest" name="CustomBindingExampleRequest">
+    </wsdl:input>
+      <wsdl:output message="tns:CustomBindingExampleResponse" name="CustomBindingExampleResponse">
+    </wsdl:output>
+    </wsdl:operation>
+    <wsdl:operation name="Example">
+      <wsdl:input message="tns:ExampleRequest" name="ExampleRequest">
+    </wsdl:input>
+      <wsdl:output message="tns:ExampleResponse" name="ExampleResponse">
+    </wsdl:output>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="ExamplesSoap12" type="tns:Examples">
+    <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="CustomBindingExample">
+      <soap12:operation soapAction=""/>
+      <wsdl:input name="CustomBindingExampleRequest">
+        <soap12:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="CustomBindingExampleResponse">
+        <soap12:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+    <wsdl:operation name="Example">
+      <soap12:operation soapAction=""/>
+      <wsdl:input name="ExampleRequest">
+        <soap12:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="ExampleResponse">
+        <soap12:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="ExamplesService">
+    <wsdl:port binding="tns:ExamplesSoap12" name="ExamplesSoap12">
+      <soap12:address location="http://localhost:8080/web-services-spring-server/spring-ws/example"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>
index 71d357b..177c13e 100644 (file)
@@ -1,21 +1,23 @@
 package de.spring.webservices.client;
 
-import name.gumartinm.spring_ws.example.CustomBindingExampleRequest;
-import name.gumartinm.spring_ws.example.CustomBindingExampleResponse;
-import name.gumartinm.spring_ws.example.ExampleRequest;
-import name.gumartinm.spring_ws.example.ExampleResponse;
-import name.gumartinm.spring_ws.example.Examples;
-import name.gumartinm.spring_ws.example.ExamplesService;
+import name.gumartinm.spring_ws.parent.ParentEnumType;
 
 import org.springframework.beans.factory.annotation.Autowired;
 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;
+
 /**
  * Someone could write code like this one in order to send and receive
  * information from our Web Services.
  * 
  */
-public class ExampleClientService {
+public class ExampleClientService {    
     private final WebServiceTemplate webServiceTemplate;
 
     @Autowired
@@ -47,6 +49,7 @@ public class ExampleClientService {
         final CustomBindingExampleRequest customBindingxampleRequest =
                        new CustomBindingExampleRequest();
         customBindingxampleRequest.setData("CUSTOM BINDING JAVA. SCARLETT. IT IS CANON.");
+        customBindingxampleRequest.setParentEnum(ParentEnumType.FIRST);
   
         final Examples exampleService = new ExamplesService().getExamplesSoap12();
         final CustomBindingExampleResponse customBindingExampleResponse =
index fc808e3..48fbdcd 100644 (file)
@@ -1,14 +1,21 @@
 package de.spring.webservices.client;
 
+import org.slf4j.Logger;
+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;
+
 /**
  * This class is used just like a nice example about how to write and run client
  * code which will send data to and from the Web Services.
  * 
  */
 public class MainTest {
+       private static final Logger logger = LoggerFactory.getLogger(MainTest.class);
+       
     public ApplicationContext context;
 
     /**
@@ -18,14 +25,28 @@ public class MainTest {
         final MainTest test = new MainTest();
 
         test.context = new ClassPathXmlApplicationContext(
-                "client-spring-configuration.xml");
+                "classpath:spring-configuration/ws/client-spring-configuration.xml");
 
         final ExampleClientService example =
                        (ExampleClientService) test.context.getBean("exampleClient");
 
-        example.sendAndReceiveJava();
-        example.sendAndReceiveJavaCustom();
-        example.sendAndReceiveSpring();
-        example.sendAndReceiveSpringCustom();
+        logger.info("ExampleResponse Java:");
+        ExampleResponse response = example.sendAndReceiveJava();
+        logger.info(response.getData());
+        
+        
+        logger.info("CustomBindingExampleResponse Java:");
+        CustomBindingExampleResponse customBindingResponse = example.sendAndReceiveJavaCustom();
+        logger.info(customBindingResponse.getData());
+        
+        
+        logger.info("ExampleResponse Spring:");
+        response = example.sendAndReceiveSpring();
+        logger.info(response.getData());
+        
+        
+        logger.info("CustomBindingExampleResponse Spring:");
+        customBindingResponse = example.sendAndReceiveSpringCustom();
+        logger.info(customBindingResponse.getData());
     }
 }
diff --git a/web-services-spring-client/src/main/java/de/spring/webservices/operations/Operations.java b/web-services-spring-client/src/main/java/de/spring/webservices/operations/Operations.java
deleted file mode 100644 (file)
index 13b5113..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-package de.spring.webservices.operations;
-
-/**
- * <p>
- * Operations: WSDL v1.1 and v2.0 
- * </p>
- * See: <a href="http://www.w3.org/TR/wsdl#_porttypes">http://www.w3.org/TR/wsdl#_porttypes</a><br>
- * See: <a href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns">
- * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns</a>
- * 
- */
-public interface Operations {
-
-    /**
-     * <p>
-     * Request-response operation WSDL v1.1
-     * </p>
-     * See: <a
-     * href="http://www.w3.org/TR/wsdl#_request-response">http://www.w3.org
-     * /TR/wsdl#_request-response</a>
-     * 
-     * @param <T>
-     *            Describes {@link Response}
-     * @param <E>
-     *            Describes {@link Request}
-     */
-    public static interface RequestResponse<T extends Response, E extends Request> {
-        T requestResponse(E request);
-    }
-
-    /**
-     * <p>
-     * One-way operation WSDL v1.1
-     * </p>
-     * See: <a
-     * href="http://www.w3.org/TR/wsdl#_one-way">http://www.w3.org/TR/wsdl
-     * #_one-way</a>
-     * 
-     * @param <T>
-     *            Describes {@link Response}
-     * @param <E>
-     *            Describes {@link Request}
-     */
-    public interface OneWay<E extends Request> {
-        void oneWay(E request);
-    }
-
-    /**
-     * <p>
-     * Notification operation WSDL v1.1
-     * </p>
-     * See: <a
-     * href="http://www.w3.org/TR/wsdl#_notification">http://www.w3.org/TR
-     * /wsdl#_notification</a>
-     * 
-     * @param <T>
-     *            Describes {@link Response}
-     * @param <E>
-     *            Describes {@link Request}
-     */
-    public interface Notification<T extends Response> {
-        T notification();
-    }
-
-    /**
-     * <p>
-     * In-Only message exchange pattern WSDL 2.0
-     * </p>
-     * See: <a
-     * href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns">
-     * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns</a>
-     * 
-     * @param <E> 
-     *             Describes {@link Request}
-     */
-    public interface InOnly<E extends Request> {
-        void inOnly(E request);
-    }
-
-    /**
-     * <p>
-     * Robust In-Only message exchange pattern WSDL 2.0
-     * </p>
-     * See: <a
-     * href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns">
-     * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns</a>
-     * 
-     * @param <E> 
-     *             Describes {@link Request}
-     */
-    public interface RobustInOnly<E extends Request> {
-        void robustInOnly(E request);
-    }
-
-    /**
-     * <p>
-     * In-Out message exchange pattern WSDL 2.0
-     * </p>
-     * See: <a
-     * href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns">
-     * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns</a>
-     * 
-     * @param <T>
-     *            Describes {@link Response}
-     * @param <E>
-     *            Describes {@link Request}
-     */
-    public interface InOut<T extends Response, E extends Request> {
-        T inOut(E request);
-    }
-}
\ No newline at end of file
diff --git a/web-services-spring-client/src/main/java/de/spring/webservices/operations/Request.java b/web-services-spring-client/src/main/java/de/spring/webservices/operations/Request.java
deleted file mode 100644 (file)
index 77d81f4..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package de.spring.webservices.operations;
-
-public interface Request {
-
-}
diff --git a/web-services-spring-client/src/main/java/de/spring/webservices/operations/Response.java b/web-services-spring-client/src/main/java/de/spring/webservices/operations/Response.java
deleted file mode 100644 (file)
index 3a2cbea..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package de.spring.webservices.operations;
-
-public interface Response {
-
-}
diff --git a/web-services-spring-client/src/main/resources/bindings/custombinding.xjb b/web-services-spring-client/src/main/resources/bindings/custombinding.xjb
deleted file mode 100644 (file)
index 4663aad..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<jaxb:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
-    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
-    xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
-    xmlns:annox="http://annox.dev.java.net"
-    jaxb:version="2.1"
-    jaxb:extensionBindingPrefixes="inheritance annox">
-    
-    <!--
-    Se procesa con Xpath si quieres meter expresiones regulares y cosas así en teoría dependes de Xpath
-    por ejemplo esto: @name=match[.] se supone que debería funcionar pero me dice que no puede
-    cambiar mas de un nodo a la vez. Puede que sea un bug de xjc que se carga las opciones de Xpath :/
-    <jaxb:bindings schemaLocation="examples.xsd"> 
-        <jaxb:bindings node="//xsd:element[@name='ExampleRequest']/xsd:complexType">
-                <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements>
-        </jaxb:bindings>
-        <jaxb:bindings node="//xsd:element[@name='ExampleResponse']/xsd:complexType">
-                <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements>
-        </jaxb:bindings>
-    </jaxb:bindings>
-    -->
-
-    <!--
-    <jaxb:bindings schemaLocation="../xsd/examples.xsd"> 
-        <jaxb:bindings node="//xsd:element[@name='CustomBindingExampleRequest']/xsd:complexType">
-                <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements>
-                <annox:annotate>@java.lang.SuppressWarnings({"unchecked","rawtypes"})</annox:annotate>
-        </jaxb:bindings>
-    </jaxb:bindings>
-
-
-    <jaxb:bindings schemaLocation="../xsd/examples.xsd"> 
-        <jaxb:bindings node="//xsd:element[@name='CustomBindingExampleResponse']/xsd:complexType">
-                <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements>
-                <annox:annotate>@java.lang.SuppressWarnings({"unchecked","rawtypes"})</annox:annotate>
-        </jaxb:bindings>
-    </jaxb:bindings>
-    -->
-
-    <!-- The same applies to annotate. If you do not want or you may not modify your xsd files you can
-         modify instead this file with your custom binding :) -->
-
-</jaxb:bindings>
diff --git a/web-services-spring-client/src/main/resources/examples.xsd b/web-services-spring-client/src/main/resources/examples.xsd
new file mode 100644 (file)
index 0000000..ae7a793
--- /dev/null
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:parent="http://gumartinm.name/spring-ws/parent"
+    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+    xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
+    xmlns:annox="http://annox.dev.java.net"
+    jaxb:version="2.1"
+    jaxb:extensionBindingPrefixes="inheritance annox"
+    elementFormDefault="qualified"
+    targetNamespace="http://gumartinm.name/spring-ws/example">
+
+    <!--
+        We are going to use catalog.cat in order to avoid downloading parent.xsd from remote server
+    -->
+    <xs:import namespace="http://gumartinm.name/spring-ws/parent" schemaLocation="http://gumartinm.name/spring-ws/parent/parent.xsd" />
+
+
+       <!-- Using inheritance and annox plugin -->
+       <xs:element name="ExampleRequest">
+          <xs:complexType>
+              <xs:annotation>
+                <xs:appinfo>
+                    <annox:annotate>@java.lang.SuppressWarnings({"unchecked","rawtypes"})</annox:annotate> 
+                    <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements>
+                </xs:appinfo>
+            </xs:annotation>   
+            <xs:all>
+                <xs:element name="data" type="xs:string" />
+            </xs:all>
+        </xs:complexType>
+       </xs:element>
+    <xs:element name="ExampleResponse">
+        <xs:complexType>
+        <xs:annotation>
+                <xs:appinfo>
+                    <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements>
+                </xs:appinfo>
+            </xs:annotation>  
+            <xs:all>
+                <xs:element name="data" type="xs:string" />
+            </xs:all>
+        </xs:complexType>
+    </xs:element>
+
+
+       <!-- Using custombinding.xjb instead of inheritance plugin.
+                Useful when you can not modify your xsd files because they are provided
+                by another person or company
+       -->
+    <xs:element name="CustomBindingExampleRequest">
+          <xs:complexType>
+            <xs:all>
+                <xs:element name="data" type="xs:string" />
+                <xs:element name="exampleDate" type="xs:dateTime" minOccurs="0" maxOccurs="1" />
+                <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" />
+            </xs:all>
+        </xs:complexType>
+       </xs:element>
+    <xs:element name="CustomBindingExampleResponse">
+        <xs:complexType>
+            <xs:all>
+                <xs:element name="data" type="xs:string" />
+                <xs:element name="exampleDate" type="xs:dateTime" minOccurs="0" maxOccurs="1" />
+                <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" />
+            </xs:all>
+        </xs:complexType>
+    </xs:element>
+
+
+</xs:schema>
diff --git a/web-services-spring-client/src/main/resources/log4j2.xml b/web-services-spring-client/src/main/resources/log4j2.xml
new file mode 100644 (file)
index 0000000..18a4008
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration status="trace" strict="true"
+                name="XMLConfigTest" packages="org.apache.logging.log4j.test">
+    <Appenders>
+        <Appender type="Console" name="STDOUT">
+            <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>
+        </Appender>
+    </Appenders>
+    <Loggers>
+        <Root level="trace">
+            <AppenderRef ref="STDOUT"/>
+        </Root>
+    </Loggers>
+</Configuration>
diff --git a/web-services-spring-client/src/main/resources/spring-configuration/client-spring-configuration.xml b/web-services-spring-client/src/main/resources/spring-configuration/client-spring-configuration.xml
deleted file mode 100644 (file)
index 32da905..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-    xmlns:context="http://www.springframework.org/schema/context"
-    xmlns:sws="http://www.springframework.org/schema/web-services"
-    xmlns:oxm="http://www.springframework.org/schema/oxm" 
-    xmlns:aop="http://www.springframework.org/schema/aop"
-    xsi:schemaLocation="http://www.springframework.org/schema/beans 
-        http://www.springframework.org/schema/beans/spring-beans.xsd
-        http://www.springframework.org/schema/context 
-        http://www.springframework.org/schema/context/spring-context.xsd
-        http://www.springframework.org/schema/web-services 
-        http://www.springframework.org/schema/web-services/web-services.xsd
-        http://www.springframework.org/schema/oxm 
-        http://www.springframework.org/schema/oxm/spring-oxm.xsd">
-
-    <!-- 
-        This file is an example about how someone should write code in order to send and
-        receive data from the Web Services.
-    -->
-   
-    <!-- Searches for @Endpoint  --> 
-    <context:component-scan base-package="de.spring.webservices"/>
-
-    <oxm:jaxb2-marshaller id="marshaller" context-path="name.gumartinm.spring_ws.example"/>
-       
-    <!-- Searches for @PayloadRoot --> 
-    <sws:annotation-driven marshaller="marshaller" unmarshaller="marshaller"/>
-     
-   
-    <!-- Required in order to use SOAP 1.2
-         id="messageFactory" is not a random choice, if you use another name it will not work
-         (Spring will end up loading SOAP 1.1)
-    -->
-    <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
-        <property name="soapVersion">
-            <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_12" />
-        </property>
-    </bean> 
-    
-    
-    <sws:interceptors>
-        <bean class="org.springframework.ws.soap.server.endpoint.interceptor.SoapEnvelopeLoggingInterceptor">
-            <property name="logRequest" value="true"/>
-            <property name="logResponse" value="true"/>
-        </bean>
-
-        <!-- 
-            Â¿Este validador funciona teniendo inheritance en el xsd? (inheritances es una cosa especial 
-            del JAXB2 que estoy usando para generar las clases desde el xsd)
-            Parece que el unmarshal (que supongo que se hace con el JAXB2 que está en el classpath
-            debido al tipo de Endpoint que estoy usando, que por cierto no sé cual JAXB2 está cogiendo realmente) 
-            funciona, así que supongo el validador tambien :/
-            Lo que realmente tampoco sé es si hay alguna relación entre los validadores y JAXB2 :/
-        -->
-        <bean id="validatingInterceptor" 
-            class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
-            <property name="schema" value="classpath:xsd/examples.xsd"/>
-            <property name="validateRequest" value="true"/>
-            <property name="validateResponse" value="true"/>
-        </bean>
-    </sws:interceptors>
-
-    <bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
-        <constructor-arg ref="messageFactory"/>
-        <property name="marshaller" ref="marshaller" />
-        <property name="unmarshaller" ref="marshaller" />
-        <property name="defaultUri" value="http://gumartinm.name/spring-ws/example"/>
-        <property name="interceptors">
-        <list>
-            <ref bean="payloadValidatingInterceptor" />
-        </list>
-    </property>
-    </bean>
-    
-    <bean id="exampleClient" class="de.spring.webservices.client.ExampleClient">
-        <property name="webServiceTemplate" ref="webServiceTemplate"/>
-    </bean>
-    
-</beans>
diff --git a/web-services-spring-client/src/main/resources/spring-configuration/ws/client-spring-configuration.xml b/web-services-spring-client/src/main/resources/spring-configuration/ws/client-spring-configuration.xml
new file mode 100644 (file)
index 0000000..785d2db
--- /dev/null
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+    xmlns:context="http://www.springframework.org/schema/context"
+    xmlns:sws="http://www.springframework.org/schema/web-services"
+    xmlns:oxm="http://www.springframework.org/schema/oxm" 
+    xmlns:aop="http://www.springframework.org/schema/aop"
+    xmlns:util="http://www.springframework.org/schema/util"
+
+    xsi:schemaLocation="http://www.springframework.org/schema/beans 
+        http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/context 
+        http://www.springframework.org/schema/context/spring-context.xsd
+        http://www.springframework.org/schema/web-services 
+        http://www.springframework.org/schema/web-services/web-services.xsd
+        http://www.springframework.org/schema/oxm 
+        http://www.springframework.org/schema/oxm/spring-oxm.xsd
+        http://www.springframework.org/schema/util
+        http://www.springframework.org/schema/util/spring-util.xsd">
+
+    <!-- 
+        This file is an example about how someone should write code in order to send and
+        receive data from the Web Services.
+    -->
+   
+    <!-- Searches for @Endpoint  --> 
+    <context:component-scan base-package="de.spring.webservices"/>
+
+    <oxm:jaxb2-marshaller id="marshaller" context-path="de.spring.webservices.auto"/>
+       
+    <!-- Searches for @PayloadRoot --> 
+    <sws:annotation-driven marshaller="marshaller" unmarshaller="marshaller"/>
+     
+   
+    <!-- Required in order to use SOAP 1.2
+         id="messageFactory" is not a random choice, if you use another name it will not work
+         (Spring will end up loading SOAP 1.1)
+    -->
+    <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
+        <property name="soapVersion">
+            <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_12" />
+        </property>
+    </bean> 
+    
+    
+    <sws:interceptors>
+        <bean class="org.springframework.ws.soap.server.endpoint.interceptor.SoapEnvelopeLoggingInterceptor">
+            <property name="logRequest" value="true"/>
+            <property name="logResponse" value="true"/>
+        </bean>
+    </sws:interceptors>
+
+    <!-- 
+        Â¿Este validador funciona teniendo inheritance en el xsd? (inheritances es una cosa especial 
+        del JAXB2 que estoy usando para generar las clases desde el xsd)
+        Parece que el unmarshal (que supongo que se hace con el JAXB2 que está en el classpath
+        debido al tipo de Endpoint que estoy usando, que por cierto no sé cual JAXB2 está cogiendo realmente) 
+        funciona, así que supongo el validador tambien :/
+        Lo que realmente tampoco sé es si hay alguna relación entre los validadores y JAXB2 :/
+    -->
+    <bean id="payloadValidatingInterceptor" 
+        class="org.springframework.ws.client.support.interceptor.PayloadValidatingInterceptor">
+        <property name="schemas">
+            <list>
+                <value>classpath:examples.xsd</value>
+                <value>classpath:parent.xsd</value>
+            </list>
+        </property>
+        <property name="validateRequest" value="true"/>
+        <property name="validateResponse" value="true"/>
+    </bean>
+    
+
+    <bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
+        <constructor-arg ref="messageFactory"/>
+        <property name="marshaller" ref="marshaller" />
+        <property name="unmarshaller" ref="marshaller" />
+
+        <!-- For local deployments change to http://localhost:8080/web-services-spring-server/spring-ws/example -->
+        <property name="defaultUri" value="http://gumartinm.name/spring-ws/example"/>
+
+        <property name="interceptors">
+            <list>
+                <ref bean="payloadValidatingInterceptor" />
+            </list>
+        </property>
+    </bean>
+    
+    <bean id="exampleClient" class="de.spring.webservices.client.ExampleClientService">
+        <!--
+        @Autowired works even using XML configuration as long as you use context:component-scan
+        <property name="webServiceTemplate" ref="webServiceTemplate"/>
+        -->
+    </bean>
+    
+</beans>
diff --git a/web-services-spring-client/src/main/resources/wsdl/example.wsdl b/web-services-spring-client/src/main/resources/wsdl/example.wsdl
deleted file mode 100644 (file)
index 895be2b..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://gumartinm.name/spring-ws/example" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://gumartinm.name/spring-ws/example" targetNamespace="http://gumartinm.name/spring-ws/example">
-  <wsdl:types>
-    <xs:schema xmlns:annox="http://annox.dev.java.net" xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" jaxb:extensionBindingPrefixes="inheritance annox" jaxb:version="2.1" targetNamespace="http://gumartinm.name/spring-ws/example">
-       
-
-       <!-- Using inheritance and annox plugin -->
-       <xs:element name="ExampleRequest">
-          <xs:complexType>
-              <xs:annotation>
-                <xs:appinfo>
-                    <annox:annotate>@java.lang.SuppressWarnings({"unchecked","rawtypes"})</annox:annotate> 
-                    <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements>
-                </xs:appinfo>
-            </xs:annotation>   
-            <xs:all>
-                <xs:element name="data" type="xs:string"/>
-            </xs:all>
-        </xs:complexType>
-       </xs:element>
-    <xs:element name="ExampleResponse">
-        <xs:complexType>
-        <xs:annotation>
-                <xs:appinfo>
-                    <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements>
-                </xs:appinfo>
-            </xs:annotation>  
-            <xs:all>
-                <xs:element name="data" type="xs:string"/>
-            </xs:all>
-        </xs:complexType>
-    </xs:element>
-
-
-       <!-- Using custombinding.xjb instead of inheritance plugin.
-                Useful when you can not modify your xsd files because they are provided
-                by another person or company
-       -->
-    <xs:element name="CustomBindingExampleRequest">
-          <xs:complexType>
-            <xs:all>
-                <xs:element name="data" type="xs:string"/>
-            </xs:all>
-        </xs:complexType>
-       </xs:element>
-    <xs:element name="CustomBindingExampleResponse">
-        <xs:complexType>
-            <xs:all>
-                <xs:element name="data" type="xs:string"/>
-            </xs:all>
-        </xs:complexType>
-    </xs:element>
-
-
-</xs:schema>
-  </wsdl:types>
-  <wsdl:message name="CustomBindingExampleRequest">
-    <wsdl:part element="tns:CustomBindingExampleRequest" name="CustomBindingExampleRequest">
-    </wsdl:part>
-  </wsdl:message>
-  <wsdl:message name="CustomBindingExampleResponse">
-    <wsdl:part element="tns:CustomBindingExampleResponse" name="CustomBindingExampleResponse">
-    </wsdl:part>
-  </wsdl:message>
-  <wsdl:message name="ExampleRequest">
-    <wsdl:part element="tns:ExampleRequest" name="ExampleRequest">
-    </wsdl:part>
-  </wsdl:message>
-  <wsdl:message name="ExampleResponse">
-    <wsdl:part element="tns:ExampleResponse" name="ExampleResponse">
-    </wsdl:part>
-  </wsdl:message>
-  <wsdl:portType name="Examples">
-    <wsdl:operation name="CustomBindingExample">
-      <wsdl:input message="tns:CustomBindingExampleRequest" name="CustomBindingExampleRequest">
-    </wsdl:input>
-      <wsdl:output message="tns:CustomBindingExampleResponse" name="CustomBindingExampleResponse">
-    </wsdl:output>
-    </wsdl:operation>
-    <wsdl:operation name="Example">
-      <wsdl:input message="tns:ExampleRequest" name="ExampleRequest">
-    </wsdl:input>
-      <wsdl:output message="tns:ExampleResponse" name="ExampleResponse">
-    </wsdl:output>
-    </wsdl:operation>
-  </wsdl:portType>
-  <wsdl:binding name="ExamplesSoap12" type="tns:Examples">
-    <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
-    <wsdl:operation name="CustomBindingExample">
-      <soap12:operation soapAction=""/>
-      <wsdl:input name="CustomBindingExampleRequest">
-        <soap12:body use="literal"/>
-      </wsdl:input>
-      <wsdl:output name="CustomBindingExampleResponse">
-        <soap12:body use="literal"/>
-      </wsdl:output>
-    </wsdl:operation>
-    <wsdl:operation name="Example">
-      <soap12:operation soapAction=""/>
-      <wsdl:input name="ExampleRequest">
-        <soap12:body use="literal"/>
-      </wsdl:input>
-      <wsdl:output name="ExampleResponse">
-        <soap12:body use="literal"/>
-      </wsdl:output>
-    </wsdl:operation>
-  </wsdl:binding>
-  <wsdl:service name="ExamplesService">
-    <wsdl:port binding="tns:ExamplesSoap12" name="ExamplesSoap12">
-      <soap12:address location="http://localhost:8080/web-services-spring-server/spring-ws/example"/>
-    </wsdl:port>
-  </wsdl:service>
-</wsdl:definitions>
\ No newline at end of file
diff --git a/web-services-spring-client/src/main/resources/xsd/examples.xsd b/web-services-spring-client/src/main/resources/xsd/examples.xsd
deleted file mode 100644 (file)
index 7f431c6..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
-    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
-    xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
-    xmlns:annox="http://annox.dev.java.net"
-    jaxb:version="2.1"
-    jaxb:extensionBindingPrefixes="inheritance annox"
-    elementFormDefault="qualified"
-    targetNamespace="http://gumartinm.name/spring-ws/example">
-       
-
-       <!-- Using inheritance and annox plugin -->
-       <xs:element name="ExampleRequest">
-          <xs:complexType>
-              <xs:annotation>
-                <xs:appinfo>
-                    <annox:annotate>@java.lang.SuppressWarnings({"unchecked","rawtypes"})</annox:annotate> 
-                    <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements>
-                </xs:appinfo>
-            </xs:annotation>   
-            <xs:all>
-                <xs:element name="data" type="xs:string" />
-            </xs:all>
-        </xs:complexType>
-       </xs:element>
-    <xs:element name="ExampleResponse">
-        <xs:complexType>
-        <xs:annotation>
-                <xs:appinfo>
-                    <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements>
-                </xs:appinfo>
-            </xs:annotation>  
-            <xs:all>
-                <xs:element name="data" type="xs:string" />
-            </xs:all>
-        </xs:complexType>
-    </xs:element>
-
-
-       <!-- Using custombinding.xjb instead of inheritance plugin.
-                Useful when you can not modify your xsd files because they are provided
-                by another person or company
-       -->
-    <xs:element name="CustomBindingExampleRequest">
-          <xs:complexType>
-            <xs:all>
-                <xs:element name="data" type="xs:string" />
-            </xs:all>
-        </xs:complexType>
-       </xs:element>
-    <xs:element name="CustomBindingExampleResponse">
-        <xs:complexType>
-            <xs:all>
-                <xs:element name="data" type="xs:string" />
-            </xs:all>
-        </xs:complexType>
-    </xs:element>
-
-
-</xs:schema>
index d4ebf5a..a536c47 100644 (file)
@@ -1,13 +1,11 @@
 package de.spring.webservices.client;
 
+import static org.junit.Assert.assertEquals;
 import static org.springframework.ws.test.client.RequestMatchers.payload;
 import static org.springframework.ws.test.client.ResponseCreators.withPayload;
-import static org.junit.Assert.*;
 
 import javax.xml.transform.Source;
 
-import name.gumartinm.spring_ws.example.ExampleResponse;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -18,9 +16,12 @@ 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;
+
 
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("/client-spring-configuration.xml")
+@ContextConfiguration("classpath*:spring-configuration/ws/client-spring-configuration.xml")
 public class ExampleClientServiceIntegrationTest {
 
        @Autowired
@@ -49,10 +50,28 @@ public class ExampleClientServiceIntegrationTest {
         mockServer.expect(payload(requestPayload)).andRespond(
                 withPayload(responsePayload));
         
-        final ExampleResponse exampleResponse = exampleClientService.sendAndReceiveSpring();
+        final ExampleResponse response = exampleClientService.sendAndReceiveSpring();
 
-        assertEquals(exampleResponse.getData(), "SNAKE EYES AND SCARLETT SPRING. IT IS CANON.");
+        assertEquals(response.getData(), "SNAKE EYES AND SCARLETT SPRING. IT IS CANON.");
+        mockServer.verify();
+    }
+    
+    @Test
+    public void customerCustomClient() throws Exception { 
+        final Source customRequestPayload = new StringSource(
+                "<CustomBindingExampleRequest xmlns='http://gumartinm.name/spring-ws/example'>" +
+                        "<data>CUSTOM BINDING SPRING. SCARLETT. IT IS CANON.</data>" +
+                "</CustomBindingExampleRequest>");
+        final Source customResponsePayload = new StringSource(
+                "<ns2:CustomBindingExampleResponse xmlns:ns2='http://gumartinm.name/spring-ws/example'>" +
+                        "<ns2:data>CUSTOM BINDING SNAKE EYES AND SCARLETT SPRING. IT IS CANON.</ns2:data>" +
+                "</ns2:CustomBindingExampleResponse>");
+        mockServer.expect(payload(customRequestPayload)).andRespond(
+                       withPayload(customResponsePayload));
         
+        final CustomBindingExampleResponse response = exampleClientService.sendAndReceiveSpringCustom();
+
+        assertEquals(response.getData(), "CUSTOM BINDING SNAKE EYES AND SCARLETT SPRING. IT IS CANON.");
         mockServer.verify();
     }
 }
diff --git a/web-services-spring-globalxsds/src/main/java/de/spring/webservices/binders/XSDateTimeCustomBinder.java b/web-services-spring-globalxsds/src/main/java/de/spring/webservices/binders/XSDateTimeCustomBinder.java
new file mode 100644 (file)
index 0000000..f39921a
--- /dev/null
@@ -0,0 +1,35 @@
+package de.spring.webservices.binders;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+
+/**
+ * ATTENTION: if you are using this custombinder you will have to create custom payload
+ * validators for Spring (AS FAR AS I KNOW)
+ *
+ */
+public class XSDateTimeCustomBinder extends XmlAdapter<String, Date> {
+
+       @Override
+    public Date unmarshal(final String dateTime) throws Exception {
+               // X pattern just works from Java >= 1.7
+               final DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
+               formatter.setTimeZone(TimeZone.getTimeZone("Europe/Madrid"));
+
+               return formatter.parse(dateTime);
+    }
+
+       @Override
+    public String marshal(final Date dateTime) throws Exception {
+               // X pattern just works from Java >= 1.7
+               final DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
+               formatter.setTimeZone(TimeZone.getTimeZone("Europe/Madrid"));
+               
+               return formatter.format(dateTime);
+    }
+}
diff --git a/web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Operations.java b/web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Operations.java
new file mode 100644 (file)
index 0000000..13b5113
--- /dev/null
@@ -0,0 +1,111 @@
+package de.spring.webservices.operations;
+
+/**
+ * <p>
+ * Operations: WSDL v1.1 and v2.0 
+ * </p>
+ * See: <a href="http://www.w3.org/TR/wsdl#_porttypes">http://www.w3.org/TR/wsdl#_porttypes</a><br>
+ * See: <a href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns">
+ * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns</a>
+ * 
+ */
+public interface Operations {
+
+    /**
+     * <p>
+     * Request-response operation WSDL v1.1
+     * </p>
+     * See: <a
+     * href="http://www.w3.org/TR/wsdl#_request-response">http://www.w3.org
+     * /TR/wsdl#_request-response</a>
+     * 
+     * @param <T>
+     *            Describes {@link Response}
+     * @param <E>
+     *            Describes {@link Request}
+     */
+    public static interface RequestResponse<T extends Response, E extends Request> {
+        T requestResponse(E request);
+    }
+
+    /**
+     * <p>
+     * One-way operation WSDL v1.1
+     * </p>
+     * See: <a
+     * href="http://www.w3.org/TR/wsdl#_one-way">http://www.w3.org/TR/wsdl
+     * #_one-way</a>
+     * 
+     * @param <T>
+     *            Describes {@link Response}
+     * @param <E>
+     *            Describes {@link Request}
+     */
+    public interface OneWay<E extends Request> {
+        void oneWay(E request);
+    }
+
+    /**
+     * <p>
+     * Notification operation WSDL v1.1
+     * </p>
+     * See: <a
+     * href="http://www.w3.org/TR/wsdl#_notification">http://www.w3.org/TR
+     * /wsdl#_notification</a>
+     * 
+     * @param <T>
+     *            Describes {@link Response}
+     * @param <E>
+     *            Describes {@link Request}
+     */
+    public interface Notification<T extends Response> {
+        T notification();
+    }
+
+    /**
+     * <p>
+     * In-Only message exchange pattern WSDL 2.0
+     * </p>
+     * See: <a
+     * href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns">
+     * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns</a>
+     * 
+     * @param <E> 
+     *             Describes {@link Request}
+     */
+    public interface InOnly<E extends Request> {
+        void inOnly(E request);
+    }
+
+    /**
+     * <p>
+     * Robust In-Only message exchange pattern WSDL 2.0
+     * </p>
+     * See: <a
+     * href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns">
+     * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns</a>
+     * 
+     * @param <E> 
+     *             Describes {@link Request}
+     */
+    public interface RobustInOnly<E extends Request> {
+        void robustInOnly(E request);
+    }
+
+    /**
+     * <p>
+     * In-Out message exchange pattern WSDL 2.0
+     * </p>
+     * See: <a
+     * href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns">
+     * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns</a>
+     * 
+     * @param <T>
+     *            Describes {@link Response}
+     * @param <E>
+     *            Describes {@link Request}
+     */
+    public interface InOut<T extends Response, E extends Request> {
+        T inOut(E request);
+    }
+}
\ No newline at end of file
diff --git a/web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Request.java b/web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Request.java
new file mode 100644 (file)
index 0000000..77d81f4
--- /dev/null
@@ -0,0 +1,5 @@
+package de.spring.webservices.operations;
+
+public interface Request {
+
+}
diff --git a/web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Response.java b/web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Response.java
new file mode 100644 (file)
index 0000000..3a2cbea
--- /dev/null
@@ -0,0 +1,5 @@
+package de.spring.webservices.operations;
+
+public interface Response {
+
+}
diff --git a/web-services-spring-server/src/main/java/de/spring/webservices/binders/XSDateTimeCustomBinder.java b/web-services-spring-server/src/main/java/de/spring/webservices/binders/XSDateTimeCustomBinder.java
deleted file mode 100644 (file)
index 46076f4..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-package de.spring.webservices.binders;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.TimeZone;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-
-
-public class XSDateTimeCustomBinder extends XmlAdapter<String, Date> {
-
-       @Override
-    public Date unmarshal(final String dateTime) throws Exception {
-               // X pattern just works from Java >= 1.7
-               final DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
-               formatter.setTimeZone(TimeZone.getTimeZone("Europe/Madrid"));
-
-               return formatter.parse(dateTime);
-    }
-
-       @Override
-    public String marshal(final Date dateTime) throws Exception {
-               // X pattern just works from Java >= 1.7
-               final DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
-               formatter.setTimeZone(TimeZone.getTimeZone("Europe/Madrid"));
-               
-               return formatter.format(dateTime);
-    }
-}
diff --git a/web-services-spring-server/src/main/java/de/spring/webservices/operations/Operations.java b/web-services-spring-server/src/main/java/de/spring/webservices/operations/Operations.java
deleted file mode 100644 (file)
index 13b5113..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-package de.spring.webservices.operations;
-
-/**
- * <p>
- * Operations: WSDL v1.1 and v2.0 
- * </p>
- * See: <a href="http://www.w3.org/TR/wsdl#_porttypes">http://www.w3.org/TR/wsdl#_porttypes</a><br>
- * See: <a href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns">
- * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns</a>
- * 
- */
-public interface Operations {
-
-    /**
-     * <p>
-     * Request-response operation WSDL v1.1
-     * </p>
-     * See: <a
-     * href="http://www.w3.org/TR/wsdl#_request-response">http://www.w3.org
-     * /TR/wsdl#_request-response</a>
-     * 
-     * @param <T>
-     *            Describes {@link Response}
-     * @param <E>
-     *            Describes {@link Request}
-     */
-    public static interface RequestResponse<T extends Response, E extends Request> {
-        T requestResponse(E request);
-    }
-
-    /**
-     * <p>
-     * One-way operation WSDL v1.1
-     * </p>
-     * See: <a
-     * href="http://www.w3.org/TR/wsdl#_one-way">http://www.w3.org/TR/wsdl
-     * #_one-way</a>
-     * 
-     * @param <T>
-     *            Describes {@link Response}
-     * @param <E>
-     *            Describes {@link Request}
-     */
-    public interface OneWay<E extends Request> {
-        void oneWay(E request);
-    }
-
-    /**
-     * <p>
-     * Notification operation WSDL v1.1
-     * </p>
-     * See: <a
-     * href="http://www.w3.org/TR/wsdl#_notification">http://www.w3.org/TR
-     * /wsdl#_notification</a>
-     * 
-     * @param <T>
-     *            Describes {@link Response}
-     * @param <E>
-     *            Describes {@link Request}
-     */
-    public interface Notification<T extends Response> {
-        T notification();
-    }
-
-    /**
-     * <p>
-     * In-Only message exchange pattern WSDL 2.0
-     * </p>
-     * See: <a
-     * href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns">
-     * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns</a>
-     * 
-     * @param <E> 
-     *             Describes {@link Request}
-     */
-    public interface InOnly<E extends Request> {
-        void inOnly(E request);
-    }
-
-    /**
-     * <p>
-     * Robust In-Only message exchange pattern WSDL 2.0
-     * </p>
-     * See: <a
-     * href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns">
-     * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns</a>
-     * 
-     * @param <E> 
-     *             Describes {@link Request}
-     */
-    public interface RobustInOnly<E extends Request> {
-        void robustInOnly(E request);
-    }
-
-    /**
-     * <p>
-     * In-Out message exchange pattern WSDL 2.0
-     * </p>
-     * See: <a
-     * href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns">
-     * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns</a>
-     * 
-     * @param <T>
-     *            Describes {@link Response}
-     * @param <E>
-     *            Describes {@link Request}
-     */
-    public interface InOut<T extends Response, E extends Request> {
-        T inOut(E request);
-    }
-}
\ No newline at end of file
diff --git a/web-services-spring-server/src/main/java/de/spring/webservices/operations/Request.java b/web-services-spring-server/src/main/java/de/spring/webservices/operations/Request.java
deleted file mode 100644 (file)
index 77d81f4..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package de.spring.webservices.operations;
-
-public interface Request {
-
-}
diff --git a/web-services-spring-server/src/main/java/de/spring/webservices/operations/Response.java b/web-services-spring-server/src/main/java/de/spring/webservices/operations/Response.java
deleted file mode 100644 (file)
index 3a2cbea..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package de.spring.webservices.operations;
-
-public interface Response {
-
-}
index fa85466..ae7a793 100644 (file)
@@ -51,8 +51,8 @@
           <xs:complexType>
             <xs:all>
                 <xs:element name="data" type="xs:string" />
-                <xs:element name="exampleDate" type="xs:dateTime" />
-                <xs:element name="parentEnum" type="parent:parentEnumType" />
+                <xs:element name="exampleDate" type="xs:dateTime" minOccurs="0" maxOccurs="1" />
+                <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" />
             </xs:all>
         </xs:complexType>
        </xs:element>
@@ -60,8 +60,8 @@
         <xs:complexType>
             <xs:all>
                 <xs:element name="data" type="xs:string" />
-                <xs:element name="exampleDate" type="xs:dateTime" />
-                <xs:element name="parentEnum" type="parent:parentEnumType" />
+                <xs:element name="exampleDate" type="xs:dateTime" minOccurs="0" maxOccurs="1" />
+                <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" />
             </xs:all>
         </xs:complexType>
     </xs:element>
index 378780d..afabf4e 100644 (file)
@@ -40,7 +40,7 @@
     <sws:dynamic-wsdl id="example" portTypeName="Examples"
         createSoap12Binding="true" createSoap11Binding="false"
         locationUri="/spring-ws/example"
-        targetNamespace="http://gumartinm.name/spring-ws/example">
+        targetNamespace="http://gumartinm.name/resource/wsdl/schemas">
         <sws:xsd location="classpath:examples.xsd"/>
     </sws:dynamic-wsdl>