Spring Web Services SOAP: new implementation
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Mon, 25 May 2015 03:19:48 +0000 (05:19 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Mon, 25 May 2015 03:19:48 +0000 (05:19 +0200)
46 files changed:
README.md
pom.xml [deleted file]
src/main/java/de/spring/webservices/business/BusinessExample.java [deleted file]
src/main/java/de/spring/webservices/business/CustomBindingBusinessExample.java [deleted file]
src/main/java/de/spring/webservices/client/ExampleClient.java [deleted file]
src/main/java/de/spring/webservices/client/Test.java [deleted file]
src/main/java/de/spring/webservices/endpoints/ExampleEndPoint.java [deleted file]
src/main/java/de/spring/webservices/operations/Operations.java [deleted file]
src/main/java/de/spring/webservices/operations/Request.java [deleted file]
src/main/java/de/spring/webservices/operations/Response.java [deleted file]
src/main/resources/client-spring-configuration.xml [deleted file]
src/main/resources/log4j.properties [deleted file]
src/main/resources/spring-configuration.xml [deleted file]
src/main/resources/wsdl/custombindingexample.wsdl [deleted file]
src/main/resources/xsd/custombinding.xjb [deleted file]
src/main/resources/xsd/examples.xsd [deleted file]
src/main/webapp/WEB-INF/spring-ws-servlet.xml [deleted file]
src/main/webapp/WEB-INF/web.xml [deleted file]
src/test/java/de/spring/webservices/tests/client/ExampleClientIntegrationTest.java [deleted file]
src/test/java/de/spring/webservices/tests/server/ExampleEndPointIntegrationTest.java [deleted file]
web-services-spring-client/pom.xml [new file with mode: 0644]
web-services-spring-client/src/main/java/de/spring/webservices/client/ExampleClientService.java [new file with mode: 0644]
web-services-spring-client/src/main/java/de/spring/webservices/client/MainTest.java [new file with mode: 0644]
web-services-spring-client/src/main/java/de/spring/webservices/operations/Operations.java [new file with mode: 0644]
web-services-spring-client/src/main/java/de/spring/webservices/operations/Request.java [new file with mode: 0644]
web-services-spring-client/src/main/java/de/spring/webservices/operations/Response.java [new file with mode: 0644]
web-services-spring-client/src/main/resources/bindings/custombinding.xjb [new file with mode: 0644]
web-services-spring-client/src/main/resources/spring-configuration/client-spring-configuration.xml [new file with mode: 0644]
web-services-spring-client/src/main/resources/wsdl/example.wsdl [new file with mode: 0644]
web-services-spring-client/src/main/resources/xsd/examples.xsd [new file with mode: 0644]
web-services-spring-client/src/test/java/de/spring/webservices/client/ExampleClientServiceIntegrationTest.java [new file with mode: 0644]
web-services-spring-server/pom.xml [new file with mode: 0644]
web-services-spring-server/src/main/java/de/spring/webservices/business/CustomBindingBusinessExample.java [new file with mode: 0644]
web-services-spring-server/src/main/java/de/spring/webservices/endpoints/ExampleEndPoint.java [new file with mode: 0644]
web-services-spring-server/src/main/java/de/spring/webservices/operations/Operations.java [new file with mode: 0644]
web-services-spring-server/src/main/java/de/spring/webservices/operations/Request.java [new file with mode: 0644]
web-services-spring-server/src/main/java/de/spring/webservices/operations/Response.java [new file with mode: 0644]
web-services-spring-server/src/main/jetty/jetty-http.xml [new file with mode: 0644]
web-services-spring-server/src/main/resources/bindings/custombinding.xjb [new file with mode: 0644]
web-services-spring-server/src/main/resources/log4j2.xml [new file with mode: 0644]
web-services-spring-server/src/main/resources/spring-configuration/spring-configuration.xml [new file with mode: 0644]
web-services-spring-server/src/main/resources/spring-configuration/ws/soap-ws.xml [new file with mode: 0644]
web-services-spring-server/src/main/resources/xsd/examples.xsd [new file with mode: 0644]
web-services-spring-server/src/main/webapp/WEB-INF/web.xml [new file with mode: 0644]
web-services-spring-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointIntegrationTest.java [new file with mode: 0644]
web-services-spring/pom.xml [new file with mode: 0644]

index acf8a71..a9896b3 100644 (file)
--- a/README.md
+++ b/README.md
@@ -4,9 +4,17 @@ SpringWebServicesForFun
 Messing around with Spring Web Services
 
 mvn clean install
+mvn clean install && mvn dependency:sources && mvn dependency:resolve -Dclassifier=javadoc
 mvn war:war
 mvn jetty:run
+mvn clean install -Dmaven.test.skip=true
+
 
 TODO: custom bindings when creating Java code from wsdl.
+TODO: using Jetty instead of Tomcat
+TODO: logging Spring information
+TODO: test catalog.cat support for Apache CXF (searching in classpath) See: http://labs.bsb.com/2011/01/usage-of-an-xml-catalog-in-the-xmlbeans-cxf-integration/
+and http://cxf.apache.org/cxf-xjc-plugin.html
+TODO: integration tests (client and server)
 
 For debugging: export MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"
diff --git a/pom.xml b/pom.xml
deleted file mode 100644 (file)
index fc0e355..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,444 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>    
-       <groupId>de.spring.webservices</groupId>
-       <artifactId>web-services-spring</artifactId>
-       <version>1</version>
-       <name>web-services-spring</name>
-       <url>http://www.gumartinm.name</url>
-       <description>Web Services Spring Framework</description>
-       <organization>
-               <name>Gustavo Martin Inc.</name>
-               <url>http://www.gumartinm.name</url>
-       </organization>
-       
-       <scm>
-        <developerConnection>scm:git:http://git.gumartinm.name/SpringWebServicesForFun</developerConnection>
-        <url>http://git.gumartinm.name/SpringWebServicesForFun</url>
-    </scm>
-       
-       <properties>
-        <project.xsd.schemas.source.path>src/main/resources/xsd</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.wsdl.sources.path>src/main/resources/wsdl</project.wsdl.sources.path>
-        <spring.ws.version>2.2.1.RELEASE</spring.ws.version>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <spring.version>4.1.6.RELEASE</spring.version>
-        <warTarget>${basedir}/target/jetty</warTarget>
-    </properties>
-       
-
-       <dependencies>
-                       <dependency>
-                               <groupId>org.springframework.ws</groupId>
-                               <artifactId>spring-ws-core</artifactId>
-                               <version>${spring.ws.version}</version>                         
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework.ws</groupId>
-                               <artifactId>spring-xml</artifactId>
-                               <version>${spring.ws.version}</version>                                                 
-                       </dependency>
-                       <dependency>
-                <groupId>org.springframework.ws</groupId>
-                <artifactId>spring-ws-test</artifactId>
-                <version>${spring.ws.version}</version>
-                <scope>test</scope>                        
-            </dependency>
-            <dependency>
-                <groupId>org.springframework</groupId>
-                <artifactId>spring-test</artifactId>
-                <version>${spring.version}</version>
-                <scope>test</scope>
-            </dependency>
-
-            <!-- Required by spring-ws-core -->
-            <dependency>
-                <groupId>wsdl4j</groupId>
-                <artifactId>wsdl4j</artifactId>
-                <version>1.6.3</version>
-            </dependency>
-
-                       <dependency>
-                               <groupId>org.jdom</groupId>
-                               <artifactId>jdom</artifactId>
-                               <version>2.0.1</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>com.sun.xml.ws</groupId>
-                               <artifactId>jaxws-rt</artifactId>
-                               <version>2.2.5</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>jaxen</groupId>
-                               <artifactId>jaxen</artifactId>
-                               <version>1.1.3</version>
-                               <exclusions>
-                                       <exclusion>
-                                               <artifactId>maven-cobertura-plugin</artifactId>
-                                               <groupId>maven-plugins</groupId>
-                                       </exclusion>
-                                       <exclusion>
-                                               <artifactId>maven-findbugs-plugin</artifactId>
-                                               <groupId>maven-plugins</groupId>
-                                       </exclusion>
-                                       <exclusion>
-                                               <artifactId>xml-apis</artifactId>
-                                               <groupId>xml-apis</groupId>
-                                       </exclusion>
-                                       <exclusion>
-                                               <artifactId>dom4j</artifactId>
-                                               <groupId>dom4j</groupId>
-                                       </exclusion>
-                                       <exclusion>
-                                               <artifactId>jdom</artifactId>
-                                               <groupId>jdom</groupId>
-                                       </exclusion>
-                                       <exclusion>
-                                               <artifactId>xom</artifactId>
-                                               <groupId>xom</groupId>
-                                       </exclusion>
-                                       <exclusion>
-                                               <artifactId>xmlParserAPIs</artifactId>
-                                               <groupId>xerces</groupId>
-                                       </exclusion>
-                                       <exclusion>
-                                               <artifactId>xercesImpl</artifactId>
-                                               <groupId>xerces</groupId>
-                                       </exclusion>
-                               </exclusions>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.mortbay.jetty</groupId>
-                               <artifactId>jsp-2.1</artifactId>
-                               <version>6.1.14</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.mortbay.jetty</groupId>
-                               <artifactId>jsp-api-2.1</artifactId>
-                               <version>6.1.14</version>
-                       </dependency>
-                       <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
-            <version>2.5</version>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-continuation</artifactId>
-            <version>7.0.0.v20091005</version>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-http</artifactId>
-            <version>7.0.0.v20091005</version>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-io</artifactId>
-            <version>7.0.0.v20091005</version>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-security</artifactId>
-            <version>7.0.0.v20091005</version>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-server</artifactId>
-            <version>7.0.0.v20091005</version>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-servlet</artifactId>
-            <version>7.0.0.v20091005</version>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-webapp</artifactId>
-            <version>7.0.0.v20091005</version>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-util</artifactId>
-            <version>7.0.0.v20091005</version>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-xml</artifactId>
-            <version>7.0.0.v20091005</version>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.12</version>
-            <scope>test</scope>
-        </dependency>
-        
-        <!-- Required by jaxb2-basics as specified: 
-            http://confluence.highsource.org/display/J2B/Using+JAXB2+Basics+Plugins+with+CXF
-         -->
-        <dependency>
-            <groupId>org.jvnet.jaxb2_commons</groupId>
-            <artifactId>jaxb2-basics-runtime</artifactId>
-            <version>0.9.4</version>
-        </dependency>
-       </dependencies>
-       <build>
-          <pluginManagement>
-            <plugins>
-                <!-- Generate code from xsd files -->
-                <plugin>
-                    <groupId>org.apache.cxf</groupId>
-                    <artifactId>cxf-xjc-plugin</artifactId>
-                    <version>3.0.3</version>
-                </plugin>
-                <!-- Generate code from wsdl files (the client's code) -->
-                <plugin>
-                    <groupId>org.apache.cxf</groupId>
-                    <artifactId>cxf-codegen-plugin</artifactId>
-                    <version>3.1.0</version>
-                </plugin>
-                <plugin>
-                    <groupId>org.codehaus.mojo</groupId>
-                    <artifactId>build-helper-maven-plugin</artifactId>
-                    <version>1.1</version>
-                </plugin>
-                <plugin>
-                    <groupId>org.mortbay.jetty</groupId>
-                    <artifactId>maven-jetty-plugin</artifactId>
-                    <version>6.1.14</version>
-                </plugin>
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-war-plugin</artifactId>
-                    <version>2.1-alpha-2</version>
-                </plugin>
-            </plugins>
-        </pluginManagement>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.3</version>
-                <configuration>
-                    <source>1.8</source>
-                    <target>1.8</target>
-                    <encoding>${project.build.sourceEncoding}</encoding>
-                </configuration>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-resources-plugin</artifactId>
-                <version>2.7</version>
-                <configuration>
-                    <encoding>${project.build.sourceEncoding}</encoding>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-javadoc-plugin</artifactId>
-                <version>2.6</version>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>jdepend-maven-plugin</artifactId>
-                <version>2.0-beta-2</version>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <version>2.4.2</version>
-                <configuration>
-                    <testFailureIgnore>true</testFailureIgnore>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <version>2.3.1</version>
-                <configuration>
-                    <archive>
-                        <manifestEntries>
-                            <Specification-Title>${project.description}</Specification-Title>
-                            <Specification-Version>${project.version}</Specification-Version>
-                            <Specification-Vendor>${project.organization.name}</Specification-Vendor>
-                            <Implementation-Title>${project.description}</Implementation-Title>
-                            <Implementation-Version>${project.version}</Implementation-Version>
-                            <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
-                        </manifestEntries>
-                    </archive>
-                </configuration>
-            </plugin>
-            
-            <!-- We could use maven-jaxb2-plugin in order to generate Java classes from XSD files but
-                this plugin seems more useful so, I keep using it. Besides, it is based on Apache CXF which
-                as well, uses jaxb. -->
-            <plugin>
-                <groupId>org.apache.cxf</groupId>
-                <artifactId>cxf-xjc-plugin</artifactId>
-                <configuration>
-                    <extensions>
-                        <extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:2.3.0</extension>
-                    </extensions>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>generate-sources-from-xsd</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>xsdtojava</goal>
-                        </goals>
-                        <configuration>
-                            <sourceRoot>${project.xsd.schemas.target.path}</sourceRoot>
-                            <xsdOptions>
-                                <xsdOption>
-                                    <extension>true</extension>
-                                    <xsd>${project.xsd.schemas.source.path}/examples.xsd</xsd>
-                                    <bindingFile>${project.xsd.schemas.source.path}/custombinding.xjb</bindingFile>
-                                    <packagename>${project.xsd.schemas.package.name}</packagename>
-                                    <extensionArgs>
-                                        <extraarg>-Xinheritance</extraarg>
-                                        <extraarg>-Xannotate</extraarg>
-                                     </extensionArgs> 
-                                </xsdOption>
-                            </xsdOptions>
-                        </configuration>
-                    </execution>
-                </executions>
-               <dependencies>
-                    <!-- We make this plugin work with this jaxb2 version.
-                         This particular version let us generate inherited classes using
-                         the -Xinheritance argument.
-        
-                         DO NOT FORGET: We can use <inheritance:implements> in xsd files or by means 
-                         of custom bindings (see custombinding.xjb) This useful when you may not modify
-                         xsd files because they are generated by other person or machine.
-                    -->
-                    <dependency>
-                        <groupId>org.jvnet.jaxb2_commons</groupId>
-                        <artifactId>jaxb2-basics</artifactId>
-                        <version>0.9.4</version>
-                    </dependency>
-
-                    <!-- We make this plugin work with this jaxb2 version.
-                         This particular version let us generate annotated classes using
-                         the -Xannotate argument.
-
-                         DO NOT FORGET: We can use <annox:annotate> in xsd files or by means 
-                         of custom bindings like I did with <inheritance:implements> (see custombinding.xjb)
-                         This useful when you may not modify xsd files because they are generated
-                         by other person or machine.
-                    -->
-                    <dependency>
-                        <groupId>org.jvnet.jaxb2_commons</groupId>
-                        <artifactId>jaxb2-basics-annotate</artifactId>
-                        <version>1.0.1</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
-            
-            <!-- We could use maven-jaxb2-plugin in order to generate Java classes from WSDL files but
-                this plugin seems more useful so, I keep using it. Besides, it is based on Apache CXF which
-                as well, uses jaxb. -->
-            <plugin>
-                <groupId>org.apache.cxf</groupId>
-                <artifactId>cxf-codegen-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>generate-sources-from-wsdl</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>wsdl2java</goal>
-                        </goals>
-                        <configuration>
-                            <sourceRoot>${project.xsd.schemas.target.path}</sourceRoot>
-                            <wsdlOptions>
-                                <wsdlOption>
-                                    <!--
-                                    <wsdl>${project.wsdl.sources.path}/example.wsdl</wsdl>
-                                    -->
-                                    <wsdl>${project.wsdl.sources.path}/custombindingexample.wsdl</wsdl>
-                                    <extraargs>
-                                        <extraarg>-xjc-Xinheritance</extraarg>
-                                    </extraargs>
-                                </wsdlOption>
-                            </wsdlOptions>
-                        </configuration>
-                     </execution>
-                </executions>
-                <dependencies>
-                    <!-- We make this plugin work with this jaxb2 version.
-                         This particular version let us generate inherited classes using
-                         the -Xinheritance argument.
-        
-                         DO NOT FORGET: We can use <inheritance:implements> in xsd files or by means 
-                         of custom bindings (see custombinding.xjb) This useful when you may not modify
-                         xsd files because they are generated by other person or machine.
-                    -->
-                    <dependency>
-                        <groupId>org.jvnet.jaxb2_commons</groupId>
-                        <artifactId>jaxb2-basics</artifactId>
-                        <version>0.9.4</version>
-                    </dependency>
-                </dependencies>
-            </plugin> 
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>build-helper-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>add-source</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>add-source</goal>
-                        </goals>
-                        <configuration>
-                            <sources>
-                                <source>${project.xsd.schemas.target.path}</source>
-                            </sources>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.mortbay.jetty</groupId>
-                <artifactId>maven-jetty-plugin</artifactId>
-                <configuration>
-                    <webAppConfig>
-                        <contextPath>/</contextPath>
-                        <baseResource implementation="org.mortbay.resource.ResourceCollection">
-                            <resourcesAsCSV>
-                                ${basedir}/src/main/webapp,
-                                ${warTarget}
-                            </resourcesAsCSV>
-                        </baseResource>
-                    </webAppConfig>
-                    <connectors>
-                        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
-                            <port>8888</port>
-                            <maxIdleTime>60000</maxIdleTime>
-                        </connector>
-                    </connectors>
-                    <scanIntervalSeconds>3</scanIntervalSeconds>
-                    <scanTargets>
-                        <scanTarget>${warTarget}</scanTarget>
-                    </scanTargets>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-war-plugin</artifactId>
-                <configuration>
-                    <warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory>
-                    <webappDirectory>${warTarget}</webappDirectory>
-                    <warName>${project.artifactId}</warName>
-                </configuration>
-            </plugin>
-        </plugins>     
-       </build>
-</project>
diff --git a/src/main/java/de/spring/webservices/business/BusinessExample.java b/src/main/java/de/spring/webservices/business/BusinessExample.java
deleted file mode 100644 (file)
index 8a722b8..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-package de.spring.webservices.business;
-
-import de.spring.webservices.auto.ExampleRequest;
-import de.spring.webservices.auto.ExampleResponse;
-import de.spring.webservices.auto.ObjectFactory;
-import de.spring.webservices.operations.Operations;
-
-/**
- * Example of business class
- *
- */
-public class BusinessExample implements Operations.RequestResponse<ExampleResponse, ExampleRequest> {
-
-    @Override
-    public ExampleResponse requestResponse(final ExampleRequest request) {
-        final ExampleResponse response = new ObjectFactory().createExampleResponse();
-        
-        response.setData("SNAKE EYES AND " + request.getData());
-        
-        return response;
-    }
-
-}
diff --git a/src/main/java/de/spring/webservices/business/CustomBindingBusinessExample.java b/src/main/java/de/spring/webservices/business/CustomBindingBusinessExample.java
deleted file mode 100644 (file)
index 864afa9..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-package de.spring.webservices.business;
-
-import de.spring.webservices.auto.CustomBindingExampleRequest;
-import de.spring.webservices.auto.CustomBindingExampleResponse;
-import de.spring.webservices.auto.ObjectFactory;
-import de.spring.webservices.operations.Operations;
-
-/**
- * Example of business class
- *
- */
-public class CustomBindingBusinessExample
-        implements Operations.RequestResponse<CustomBindingExampleResponse, CustomBindingExampleRequest> {
-
-    @Override
-    public CustomBindingExampleResponse requestResponse(final CustomBindingExampleRequest request) {
-        final CustomBindingExampleResponse response = new ObjectFactory().createCustomBindingExampleResponse();
-
-        response.setData("CUSTOM BINDING SNAKE EYES AND " + request.getData());
-
-        return response;
-    }
-
-}
diff --git a/src/main/java/de/spring/webservices/client/ExampleClient.java b/src/main/java/de/spring/webservices/client/ExampleClient.java
deleted file mode 100644 (file)
index 3512d28..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-package de.spring.webservices.client;
-
-import localhost._8888.spring_ws.example.CustomBindingExampleRequest;
-import localhost._8888.spring_ws.example.CustomBindingExampleResponse;
-import localhost._8888.spring_ws.example.ExampleRequest;
-import localhost._8888.spring_ws.example.ExampleResponse;
-import localhost._8888.spring_ws.example.Examples;
-import localhost._8888.spring_ws.example.ExamplesService;
-import localhost._8888.spring_ws.example.ObjectFactory;
-
-import org.springframework.ws.client.core.WebServiceTemplate;
-
-/**
- * Someone could write code like this one in order to send and receive
- * information from our Web Services.
- * 
- */
-public class ExampleClient {
-    private WebServiceTemplate webServiceTemplate;
-    private String Uri;
-
-
-    public void setWebServiceTemplate(
-            final WebServiceTemplate webServiceTemplate) {
-        this.webServiceTemplate = webServiceTemplate;
-    }
-
-    public void setDefaultUri(final String defaultUri) {
-        this.Uri = defaultUri;
-    }
-
-    public void sendAndReceive() {
-        final Examples exampleService = new ExamplesService().getExamplesSoap11();
-        final ExampleRequest exampleRequest = new ObjectFactory().createExampleRequest();
-        final CustomBindingExampleRequest customBindingxampleRequest =
-                new ObjectFactory().createCustomBindingExampleRequest();
-        exampleRequest.setData("SCARLETT. IT IS CANON.");
-        customBindingxampleRequest.setData("CUSTOM BINDING. SCARLETT. IT IS CANON.");
-
-        //There are two options O.o:
-
-        //1. Through Java:
-        ExampleResponse exampleResponse = exampleService.example(exampleRequest);
-        System.out.println(exampleResponse.getData());
-        CustomBindingExampleResponse customBindingExampleResponse =
-                exampleService.customBindingExample(customBindingxampleRequest);
-        System.out.println(customBindingExampleResponse.getData());
-
-        //2. Using Spring:
-        this.webServiceTemplate.setDefaultUri(this.Uri);
-        exampleResponse = (ExampleResponse)
-                this.webServiceTemplate.marshalSendAndReceive(exampleRequest);
-        this.webServiceTemplate.setDefaultUri(this.Uri);
-        customBindingExampleResponse = (CustomBindingExampleResponse) this.webServiceTemplate
-                .marshalSendAndReceive(customBindingxampleRequest);
-
-        System.out.println(exampleResponse.getData());
-        System.out.println(customBindingExampleResponse.getData());
-    }
-}
diff --git a/src/main/java/de/spring/webservices/client/Test.java b/src/main/java/de/spring/webservices/client/Test.java
deleted file mode 100644 (file)
index 37f979c..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-package de.spring.webservices.client;
-
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- * 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 Test {
-    public ApplicationContext context;
-
-    /**
-     * @param args
-     */
-    public static void main(final String[] args) {
-        final Test test = new Test();
-
-        test.context = new ClassPathXmlApplicationContext(
-                "client-spring-configuration.xml");
-
-        final ExampleClient example = (ExampleClient) test.context.getBean("exampleClient");
-
-        example.sendAndReceive();
-    }
-}
diff --git a/src/main/java/de/spring/webservices/endpoints/ExampleEndPoint.java b/src/main/java/de/spring/webservices/endpoints/ExampleEndPoint.java
deleted file mode 100644 (file)
index cef1f83..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-package de.spring.webservices.endpoints;
-
-import org.jdom2.Element;
-import org.springframework.ws.context.MessageContext;
-import org.springframework.ws.server.endpoint.annotation.Endpoint;
-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;
-
-
-@Endpoint
-public class ExampleEndPoint {
-    private static final String NAMESPACE_URI = "http://localhost:8888/spring-ws/example";
-    private Operations.RequestResponse<ExampleResponse, ExampleRequest> example;
-    private Operations.RequestResponse<CustomBindingExampleResponse, CustomBindingExampleRequest> customBindingExample;
-
-
-    public ExampleEndPoint() {}
-
-
-    @PayloadRoot(localPart = "ExampleRequest", namespace = NAMESPACE_URI)
-    @ResponsePayload
-    public ExampleResponse order(
-            @RequestPayload final ExampleRequest requestObject,
-            @RequestPayload final Element element,
-            final MessageContext messageContext) {
-
-        return example.requestResponse(requestObject);
-    }
-
-    @PayloadRoot(localPart = "CustomBindingExampleRequest", namespace = NAMESPACE_URI)
-    @ResponsePayload
-    public CustomBindingExampleResponse order(
-            @RequestPayload final CustomBindingExampleRequest requestObject,
-            @RequestPayload final Element element,
-            final MessageContext messageContext) {
-
-        return this.customBindingExample.requestResponse(requestObject);
-    }
-
-
-    /** Setter required by Spring **/
-    public void setExample(
-            final Operations.RequestResponse<ExampleResponse, ExampleRequest> example) {
-        this.example = example;
-    }
-
-    public void setCustomBindingExample(
-            final Operations.RequestResponse<CustomBindingExampleResponse, CustomBindingExampleRequest> customBindingExample) {
-        this.customBindingExample = customBindingExample;
-    }
-}
diff --git a/src/main/java/de/spring/webservices/operations/Operations.java b/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/src/main/java/de/spring/webservices/operations/Request.java b/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/src/main/java/de/spring/webservices/operations/Response.java b/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/src/main/resources/client-spring-configuration.xml b/src/main/resources/client-spring-configuration.xml
deleted file mode 100644 (file)
index 83c6910..0000000
+++ /dev/null
@@ -1,60 +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-3.1.xsd
-        http://www.springframework.org/schema/context 
-        http://www.springframework.org/schema/context/spring-context-3.1.xsd
-        http://www.springframework.org/schema/web-services 
-        http://www.springframework.org/schema/web-services/web-services-2.0.xsd
-        http://www.springframework.org/schema/oxm 
-        http://www.springframework.org/schema/oxm/spring-oxm-3.1.xsd">
-
-    <!-- 
-        This file is an example about how someone should write code in order to send and
-        receive data from the Web Services.
-    -->
-    
-     <context:component-scan base-package="de.spring.webservices"/>
-     
-    <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"/>
-
-
-    <oxm:jaxb2-marshaller id="marshaller" contextPath="localhost._8888.spring_ws.example"/>
-    
-    <!-- ¿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)
-        El marshal lo estoy haciendo con JAXB2 (lo que no sé es que JAXB2 está realmente usando
-        pues me parece que hay varios en el classpath) y funciona, así que supongo que el
-        validador también :/ 
-        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="schema" value="classpath:xsd/examples.xsd"/>
-        <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" />
-        <property name="defaultUri" value="http://localhost:8888/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"/>
-        <property name="defaultUri" value="http://localhost:8888/spring-ws/example"/>
-    </bean>
-    
-</beans>
diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
deleted file mode 100644 (file)
index 999a154..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-log4j.rootLogger=WARN, stdout
-log4j.logger.org.springframework.ws=INFO
-log4j.logger.org.springframework.xml=INFO
-log4j.logger.de.spring.webservices=INFO
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yyyyMMddHHmmssSSS} - %-5p - [%t] - %m%n
diff --git a/src/main/resources/spring-configuration.xml b/src/main/resources/spring-configuration.xml
deleted file mode 100644 (file)
index ec5aa9a..0000000
+++ /dev/null
@@ -1,97 +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: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/web-services 
-                      http://www.springframework.org/schema/web-services/web-services.xsd
-                      http://www.springframework.org/schema/context 
-                      http://www.springframework.org/schema/context/spring-context.xsd
-                      http://www.springframework.org/schema/util 
-                      http://www.springframework.org/schema/util/spring-util.xsd">
-
-
-    <context:component-scan base-package="de.spring.webservices"/>
-
-    <!--
-        Aqui se podría especificar un unmarshaller (para la request) o un
-        marshaller (para la response) especifico. Por ejemplo Castor.
-        
-        Por la anotacion que uso para el EndPoint y porque tengo JAXB2 en el
-        classpath, creo que Spring lo que está haciendo es el equivalente ha si se 
-        escribiera lo siguiente:
-        
-        <oxm:jaxb2-marshaller id="marshaller" contextPath="de.spring.webservices.auto"/>
-        
-        <sws:annotation-driven marshaller="marshaller" unmarshaller="marshaller"/>
-     -->
-    <sws:annotation-driven/>
-
-    <!--
-        Spring makes the WSDL file for us from the XSD file.
-        Launch the Jetty server and download WSDL file from this URL: http://127.0.0.1:8888/spring-ws/example/example.wsdl
-    -->
-    <sws:dynamic-wsdl id="example" portTypeName="Examples"
-        createSoap12Binding="true" createSoap11Binding="false"
-        locationUri="/spring-ws/example">
-        <sws:xsd location="classpath:xsd/examples.xsd"/>
-    </sws:dynamic-wsdl>
-
-
-    <!-- Required in order to use SOAP 1.2 -->
-    <bean id="messageFactorySoap12" 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="false"/>
-            <property name="validateResponse" value="true"/>
-        </bean>
-    </sws:interceptors>
-    
-   
-    <bean id="exceptionResolver"
-        class="org.springframework.ws.soap.server.endpoint.SoapFaultMappingExceptionResolver">
-        <property name="defaultFault" value="SERVER"/>
-        <property name="exceptionMappings">
-            <value>
-                org.springframework.oxm.ValidationFailureException=CLIENT,Invalid request
-            </value>
-        </property>
-    </bean>
-    
-    <bean id="exampleBusiness" class="de.spring.webservices.business.BusinessExample">
-    </bean>
-
-    <bean id="customBindingExampleBusiness" class="de.spring.webservices.business.CustomBindingBusinessExample">
-    </bean>
-    
-    <bean id="exampleEndPoint" class="de.spring.webservices.endpoints.ExampleEndPoint" >
-        <property name="example" ref="exampleBusiness" />  
-        <property name="customBindingExample" ref="customBindingExampleBusiness" />
-    </bean>
-
-    
-</beans>
diff --git a/src/main/resources/wsdl/custombindingexample.wsdl b/src/main/resources/wsdl/custombindingexample.wsdl
deleted file mode 100644 (file)
index 0f163b1..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://localhost:8888/spring-ws/example" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://localhost:8888/spring-ws/example" targetNamespace="http://localhost:8888/spring-ws/example">
-  <wsdl:types>
-    <xs:schema 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" jaxb:version="2.1" targetNamespace="http://localhost:8888/spring-ws/example">
-       
-
-       <xs:element name="ExampleRequest">
-          <xs:complexType>
-              <xs:annotation>
-                <xs:appinfo>
-                    <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>
-
-    <xs:element name="CustomBindingExampleRequest">
-          <xs:complexType>
-              <xs:annotation>
-                <xs:appinfo>
-                    <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="CustomBindingExampleResponse">
-        <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>
-
-
-</xs:schema>
-  </wsdl:types>
-  <wsdl:message name="CustomBindingExampleResponse">
-    <wsdl:part element="tns:CustomBindingExampleResponse" name="CustomBindingExampleResponse">
-    </wsdl:part>
-  </wsdl:message>
-  <wsdl:message name="CustomBindingExampleRequest">
-    <wsdl:part element="tns:CustomBindingExampleRequest" name="CustomBindingExampleRequest">
-    </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="ExamplesSoap11" type="tns:Examples">
-    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
-    <wsdl:operation name="CustomBindingExample">
-      <soap:operation soapAction=""/>
-      <wsdl:input name="CustomBindingExampleRequest">
-        <soap:body use="literal"/>
-      </wsdl:input>
-      <wsdl:output name="CustomBindingExampleResponse">
-        <soap:body use="literal"/>
-      </wsdl:output>
-    </wsdl:operation>
-    <wsdl:operation name="Example">
-      <soap:operation soapAction=""/>
-      <wsdl:input name="ExampleRequest">
-        <soap:body use="literal"/>
-      </wsdl:input>
-      <wsdl:output name="ExampleResponse">
-        <soap:body use="literal"/>
-      </wsdl:output>
-    </wsdl:operation>
-  </wsdl:binding>
-  <wsdl:service name="ExamplesService">
-    <wsdl:port binding="tns:ExamplesSoap11" name="ExamplesSoap11">
-      <soap:address location="http://127.0.0.1:8888/spring-ws/example"/>
-    </wsdl:port>
-  </wsdl:service>
-</wsdl:definitions>
\ No newline at end of file
diff --git a/src/main/resources/xsd/custombinding.xjb b/src/main/resources/xsd/custombinding.xjb
deleted file mode 100644 (file)
index 08d81e9..0000000
+++ /dev/null
@@ -1,42 +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="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="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 cand
-         modify instead this file with your custom binding :) -->
-
-</jaxb:bindings>
diff --git a/src/main/resources/xsd/examples.xsd b/src/main/resources/xsd/examples.xsd
deleted file mode 100644 (file)
index f8f068b..0000000
+++ /dev/null
@@ -1,56 +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://localhost:8888/spring-ws/example">
-       
-
-       <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>
-
-    <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>
diff --git a/src/main/webapp/WEB-INF/spring-ws-servlet.xml b/src/main/webapp/WEB-INF/spring-ws-servlet.xml
deleted file mode 100644 (file)
index 88b4eb1..0000000
+++ /dev/null
@@ -1,9 +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"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans 
-       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
-       
-       <import resource="classpath:spring-configuration.xml"/>
-       
-</beans>
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644 (file)
index 2789794..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
-         version="2.4">
-
-    <display-name>Spring Web Services: example</display-name>
-
-    <servlet>
-        <servlet-name>spring-ws</servlet-name>
-        <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
-        <load-on-startup>1</load-on-startup>
-        <init-param>
-            <param-name>transformWsdlLocations</param-name>
-            <param-value>true</param-value>
-        </init-param>
-    </servlet>
-
-
-    <servlet-mapping>
-        <servlet-name>spring-ws</servlet-name>
-        <url-pattern>/spring-ws/*</url-pattern>
-    </servlet-mapping>
-    
-
-</web-app>
diff --git a/src/test/java/de/spring/webservices/tests/client/ExampleClientIntegrationTest.java b/src/test/java/de/spring/webservices/tests/client/ExampleClientIntegrationTest.java
deleted file mode 100644 (file)
index db51938..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-package de.spring.webservices.tests.client;
-
-import static org.springframework.ws.test.client.RequestMatchers.payload;
-import static org.springframework.ws.test.client.ResponseCreators.withPayload;
-
-import javax.xml.transform.Source;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.ws.test.client.MockWebServiceServer;
-import org.springframework.xml.transform.StringSource;
-
-import de.spring.webservices.client.ExampleClient;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("/client-spring-configuration.xml")
-public class ExampleClientIntegrationTest {
-
-    @Autowired
-    private ExampleClient client;
-
-    private MockWebServiceServer mockServer;
-
-    @Before
-    public void createServer() throws Exception {
-        // mockServer = MockWebServiceServer.createServer(client);
-    }
-
-    @Test
-    public void customerClient() throws Exception {
-        final Source requestPayload = new StringSource(
-                "<ExampleRequest xmlns='http://localhost:8888/spring-ws/example'>"
-                        + "<data>SCARLETT. IT IS CANON.</data>"
-                        + "</ExampleRequest>");
-        final Source responsePayload = new StringSource(
-                "<ns2:ExampleResponse xmlns:ns2='http://localhost:8888/spring-ws/example'>"
-                        + "<ns2:data>SNAKE EYES AND SCARLETT. IT IS CANON.</ns2:data>"
-                        + "</ns2:ExampleResponse>");
-        mockServer.expect(payload(requestPayload)).andRespond(
-                withPayload(responsePayload));
-
-        mockServer.verify();
-    }
-}
diff --git a/src/test/java/de/spring/webservices/tests/server/ExampleEndPointIntegrationTest.java b/src/test/java/de/spring/webservices/tests/server/ExampleEndPointIntegrationTest.java
deleted file mode 100644 (file)
index ee41c24..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-package de.spring.webservices.tests.server;
-
-import static org.springframework.ws.test.server.RequestCreators.withPayload;
-import static org.springframework.ws.test.server.ResponseMatchers.payload;
-
-import javax.xml.transform.Source;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.ws.test.server.MockWebServiceClient;
-import org.springframework.xml.transform.StringSource;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("/spring-configuration.xml")
-public class ExampleEndPointIntegrationTest {
-
-    @Autowired
-    private ApplicationContext applicationContext;
-
-    private MockWebServiceClient mockClient;
-
-    @Before
-    public void createClient() {
-        mockClient = MockWebServiceClient.createClient(applicationContext);
-    }
-
-    @Test
-    public void exampleEndpoint() throws Exception {
-        final Source requestPayload = new StringSource(
-                "<ExampleRequest xmlns='http://localhost:8888/spring-ws/example'>" +
-                        "<data>SCARLETT</data>" +
-                "</ExampleRequest>");
-        final Source responsePayload = new StringSource(
-                "<ns2:ExampleResponse xmlns:ns2='http://localhost:8888/spring-ws/example'>" +
-                        "<ns2:data>SNAKE EYES AND SCARLETT</ns2:data>" +
-                "</ns2:ExampleResponse>");
-        mockClient.sendRequest(withPayload(requestPayload)).andExpect(
-                payload(responsePayload));
-    }
-}
diff --git a/web-services-spring-client/pom.xml b/web-services-spring-client/pom.xml
new file mode 100644 (file)
index 0000000..4ba6e18
--- /dev/null
@@ -0,0 +1,170 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>web-services-spring</artifactId>
+    <groupId>de.spring.webservices</groupId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>web-services-spring-client</artifactId>
+  <name>web-services-spring-client</name>
+  <url>http://gumartinm.name</url>
+
+  <properties>
+    <project.wsdl.sources.path>src/main/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> 
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework.ws</groupId>
+      <artifactId>spring-ws-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.ws</groupId>
+      <artifactId>spring-xml</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>org.jdom</groupId>
+        <artifactId>jdom</artifactId>
+    </dependency>
+
+    <!-- Required by spring-ws-core -->
+    <dependency>
+        <groupId>wsdl4j</groupId>
+        <artifactId>wsdl4j</artifactId>
+    </dependency>
+
+    <!-- Required by jaxb2-basics as specified: 
+         http://confluence.highsource.org/display/J2B/Using+JAXB2+Basics+Plugins+with+CXF
+    -->
+    <dependency>
+      <groupId>org.jvnet.jaxb2_commons</groupId>
+      <artifactId>jaxb2-basics-runtime</artifactId>
+      <version>0.9.4</version>
+    </dependency>
+
+    <!-- Unitary and integration tests -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.ws</groupId>
+      <artifactId>spring-ws-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <finalName>${project.artifactId}</finalName>
+    <resources>
+        <resource>
+            <directory>${basedir}/src/main/resources/</directory>
+            <includes>
+                <include>**/*.*</include>
+            </includes>
+        </resource>
+    </resources>
+    <plugins>
+        <!-- Generate code from wsdl files:
+             We could use maven-jaxb2-plugin in order to generate Java classes from WSDL files but
+             this plugin seems more useful so, I keep using it. Besides, it is based on Apache CXF which
+             as well, uses jaxb.
+
+             See: http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html
+        -->
+        <plugin>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-codegen-plugin</artifactId>
+            <version>3.1.0</version>
+            <executions>
+                <execution>
+                    <id>generate-sources-from-wsdl</id>
+                    <phase>generate-sources</phase>
+                    <goals>
+                        <goal>wsdl2java</goal>
+                    </goals>
+                    <configuration>
+                        <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>
+                                </bindingFiles>
+                                <extraargs>
+                                    <extraarg>-xjc-Xinheritance</extraarg>
+                                    <extraarg>-xjc-Xannotate</extraarg>
+                                    <extraarg>-verbose</extraarg>
+                                </extraargs>
+                            </wsdlOption>
+                        </wsdlOptions>
+                    </configuration>
+                 </execution>
+            </executions>
+            <dependencies>
+                 <!-- We make this plugin work with this jaxb2 version.
+                      This particular version let us generate inherited classes using
+                      the -Xinheritance argument.
+     
+                      DO NOT FORGET: We can use <inheritance:implements> in xsd files or by means 
+                      of custom bindings (see custombinding.xjb) This is useful when you may not modify
+                      xsd files because they are generated by other person or machine.
+                 -->
+                 <dependency>
+                     <groupId>org.jvnet.jaxb2_commons</groupId>
+                     <artifactId>jaxb2-basics</artifactId>
+                     <version>0.9.4</version>
+                 </dependency>
+
+                 <!-- We make this plugin work with this jaxb2 version.
+                      This particular version let us generate annotated classes using
+                      the -Xannotate argument.
+
+                      DO NOT FORGET: We can use <annox:annotate> in xsd files or by means 
+                      of custom bindings like I did with <inheritance:implements> (see custombinding.xjb)
+                      This is useful when you may not modify xsd files because they are generated
+                      by other person or machine.
+                 -->
+                 <dependency>
+                     <groupId>org.jvnet.jaxb2_commons</groupId>
+                     <artifactId>jaxb2-basics-annotate</artifactId>
+                     <version>1.0.1</version>
+                 </dependency>
+             </dependencies>
+        </plugin>
+        <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.9.1</version>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>${project.wsdl.target.path}</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+          </plugin>
+    </plugins>
+  </build>
+</project>
+
diff --git a/web-services-spring-client/src/main/java/de/spring/webservices/client/ExampleClientService.java b/web-services-spring-client/src/main/java/de/spring/webservices/client/ExampleClientService.java
new file mode 100644 (file)
index 0000000..71d357b
--- /dev/null
@@ -0,0 +1,69 @@
+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 org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.ws.client.core.WebServiceTemplate;
+
+/**
+ * Someone could write code like this one in order to send and receive
+ * information from our Web Services.
+ * 
+ */
+public class ExampleClientService {
+    private final WebServiceTemplate webServiceTemplate;
+
+    @Autowired
+    public ExampleClientService(WebServiceTemplate webServiceTemplate) {
+           this.webServiceTemplate = webServiceTemplate;
+    }
+
+       public ExampleResponse sendAndReceiveJava() {
+        final ExampleRequest exampleRequest = new ExampleRequest();
+        exampleRequest.setData("SCARLETT JAVA. IT IS CANON.");
+
+        final Examples exampleService = new ExamplesService().getExamplesSoap12();
+        final ExampleResponse exampleResponse = exampleService.example(exampleRequest);
+        
+        return exampleResponse;
+    }
+    
+       public ExampleResponse sendAndReceiveSpring() {
+        final ExampleRequest exampleRequest = new ExampleRequest();
+        exampleRequest.setData("SCARLETT SPRING. IT IS CANON.");
+
+        final ExampleResponse exampleResponse = (ExampleResponse)
+                this.webServiceTemplate.marshalSendAndReceive(exampleRequest);
+        
+        return exampleResponse;
+    }
+       
+       public CustomBindingExampleResponse sendAndReceiveJavaCustom() {
+        final CustomBindingExampleRequest customBindingxampleRequest =
+                       new CustomBindingExampleRequest();
+        customBindingxampleRequest.setData("CUSTOM BINDING JAVA. SCARLETT. IT IS CANON.");
+  
+        final Examples exampleService = new ExamplesService().getExamplesSoap12();
+        final CustomBindingExampleResponse customBindingExampleResponse =
+                exampleService.customBindingExample(customBindingxampleRequest);
+        
+        return customBindingExampleResponse;
+    }
+       
+       public CustomBindingExampleResponse sendAndReceiveSpringCustom() {
+        final CustomBindingExampleRequest customBindingxampleRequest =
+                       new CustomBindingExampleRequest();
+        customBindingxampleRequest.setData("CUSTOM BINDING SPRING. SCARLETT. IT IS CANON.");
+
+        final CustomBindingExampleResponse customBindingExampleResponse =
+                       (CustomBindingExampleResponse) this.webServiceTemplate
+                       .marshalSendAndReceive(customBindingxampleRequest);
+        
+        return customBindingExampleResponse;
+    }
+}
diff --git a/web-services-spring-client/src/main/java/de/spring/webservices/client/MainTest.java b/web-services-spring-client/src/main/java/de/spring/webservices/client/MainTest.java
new file mode 100644 (file)
index 0000000..fc808e3
--- /dev/null
@@ -0,0 +1,31 @@
+package de.spring.webservices.client;
+
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * 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 {
+    public ApplicationContext context;
+
+    /**
+     * @param args
+     */
+    public static void main(final String[] args) {
+        final MainTest test = new MainTest();
+
+        test.context = new ClassPathXmlApplicationContext(
+                "client-spring-configuration.xml");
+
+        final ExampleClientService example =
+                       (ExampleClientService) test.context.getBean("exampleClient");
+
+        example.sendAndReceiveJava();
+        example.sendAndReceiveJavaCustom();
+        example.sendAndReceiveSpring();
+        example.sendAndReceiveSpringCustom();
+    }
+}
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
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-client/src/main/java/de/spring/webservices/operations/Request.java b/web-services-spring-client/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-client/src/main/java/de/spring/webservices/operations/Response.java b/web-services-spring-client/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-client/src/main/resources/bindings/custombinding.xjb b/web-services-spring-client/src/main/resources/bindings/custombinding.xjb
new file mode 100644 (file)
index 0000000..4663aad
--- /dev/null
@@ -0,0 +1,44 @@
+<?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/spring-configuration/client-spring-configuration.xml b/web-services-spring-client/src/main/resources/spring-configuration/client-spring-configuration.xml
new file mode 100644 (file)
index 0000000..32da905
--- /dev/null
@@ -0,0 +1,80 @@
+<?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/wsdl/example.wsdl b/web-services-spring-client/src/main/resources/wsdl/example.wsdl
new file mode 100644 (file)
index 0000000..895be2b
--- /dev/null
@@ -0,0 +1,113 @@
+<?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
new file mode 100644 (file)
index 0000000..7f431c6
--- /dev/null
@@ -0,0 +1,60 @@
+<?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>
diff --git a/web-services-spring-client/src/test/java/de/spring/webservices/client/ExampleClientServiceIntegrationTest.java b/web-services-spring-client/src/test/java/de/spring/webservices/client/ExampleClientServiceIntegrationTest.java
new file mode 100644 (file)
index 0000000..d4ebf5a
--- /dev/null
@@ -0,0 +1,59 @@
+package de.spring.webservices.client;
+
+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;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.ws.client.core.WebServiceTemplate;
+import org.springframework.ws.test.client.MockWebServiceServer;
+import org.springframework.xml.transform.StringSource;
+
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("/client-spring-configuration.xml")
+public class ExampleClientServiceIntegrationTest {
+
+       @Autowired
+       ExampleClientService exampleClientService;
+       
+    @Autowired
+    private WebServiceTemplate webServiceTemplate;
+
+    private MockWebServiceServer mockServer;
+
+    @Before
+    public void createServer() throws Exception {
+        mockServer = MockWebServiceServer.createServer(webServiceTemplate);
+    }
+
+    @Test
+    public void customerClient() throws Exception {
+        final Source requestPayload = new StringSource(
+                "<ExampleRequest xmlns='http://gumartinm.name/spring-ws/example'>"
+                        + "<data>SCARLETT SPRING. IT IS CANON.</data>"
+                        + "</ExampleRequest>");
+        final Source responsePayload = new StringSource(
+                "<ns2:ExampleResponse xmlns:ns2='http://gumartinm.name/spring-ws/example'>"
+                        + "<ns2:data>SNAKE EYES AND SCARLETT SPRING. IT IS CANON.</ns2:data>"
+                        + "</ns2:ExampleResponse>");
+        mockServer.expect(payload(requestPayload)).andRespond(
+                withPayload(responsePayload));
+        
+        final ExampleResponse exampleResponse = exampleClientService.sendAndReceiveSpring();
+
+        assertEquals(exampleResponse.getData(), "SNAKE EYES AND SCARLETT SPRING. IT IS CANON.");
+        
+        mockServer.verify();
+    }
+}
+
diff --git a/web-services-spring-server/pom.xml b/web-services-spring-server/pom.xml
new file mode 100644 (file)
index 0000000..18ec398
--- /dev/null
@@ -0,0 +1,203 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>web-services-spring</artifactId>
+    <groupId>de.spring.webservices</groupId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>web-services-spring-server</artifactId>
+  <packaging>war</packaging>
+  <name>web-services-spring-server</name>
+  <url>http://gumartinm.name</url>
+
+  <properties>
+    <jetty.version>9.3.0.RC0</jetty.version>
+    <project.xsd.schemas.source.path>src/main/resources/xsd</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.bindings.path>src/main/resources/bindings</project.bindings.path>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework.ws</groupId>
+      <artifactId>spring-ws-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.ws</groupId>
+      <artifactId>spring-xml</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>org.jdom</groupId>
+        <artifactId>jdom</artifactId>
+    </dependency>
+
+    <!-- Required by spring-ws-core -->
+    <dependency>
+        <groupId>wsdl4j</groupId>
+        <artifactId>wsdl4j</artifactId>
+    </dependency>
+
+    <!-- Required by jaxb2-basics as specified: 
+         http://confluence.highsource.org/display/J2B/Using+JAXB2+Basics+Plugins+with+CXF
+    -->
+    <dependency>
+      <groupId>org.jvnet.jaxb2_commons</groupId>
+      <artifactId>jaxb2-basics-runtime</artifactId>
+      <version>0.9.4</version>
+    </dependency>
+
+    <!-- Unitary and integration tests -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.ws</groupId>
+      <artifactId>spring-ws-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <finalName>${project.artifactId}</finalName>
+    <resources>
+        <resource>
+            <directory>${basedir}/src/main/webapp</directory>
+            <excludes>
+                <exclude>**/*.*</exclude>
+            </excludes>
+        </resource>
+        <resource>
+            <directory>${basedir}/src/main/resources/</directory>
+            <includes>
+                <include>**/*.*</include>
+            </includes>
+        </resource>
+    </resources>
+    <plugins>
+        <!-- Generate code from xsd files:
+             We could use maven-jaxb2-plugin in order to generate Java classes from XSD files but
+             this plugin seems more useful so, I keep using it. Besides, it is based on Apache CXF which
+             as well, uses jaxb.
+
+             See: http://cxf.apache.org/cxf-xjc-plugin.html
+        -->
+        <plugin>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-xjc-plugin</artifactId>
+            <version>3.0.3</version>
+            <configuration>
+                <extensions>
+                    <extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:2.3.0</extension>
+                </extensions>
+            </configuration>
+            <executions>
+                <execution>
+                    <id>generate-sources-from-xsd</id>
+                    <phase>generate-sources</phase>
+                    <goals>
+                        <goal>xsdtojava</goal>
+                    </goals>
+                    <configuration>
+                        <sourceRoot>${project.xsd.schemas.target.path}</sourceRoot>
+                        <xsdOptions>
+                            <xsdOption>
+                                <extension>true</extension>
+                                <xsd>${project.xsd.schemas.source.path}/examples.xsd</xsd>
+                                <bindingFile>${project.bindings.path}/custombinding.xjb</bindingFile>
+                                <packagename>${project.xsd.schemas.package.name}</packagename>
+                                <extensionArgs>
+                                    <extraarg>-Xinheritance</extraarg>
+                                    <extraarg>-Xannotate</extraarg>
+                                 </extensionArgs>
+                            </xsdOption>
+                        </xsdOptions>
+                    </configuration>
+                </execution>
+            </executions>
+            <dependencies>
+                 <!-- We make this plugin work with this jaxb2 version.
+                      This particular version let us generate inherited classes using
+                      the -Xinheritance argument.
+     
+                      DO NOT FORGET: We can use <inheritance:implements> in xsd files or by means 
+                      of custom bindings (see custombinding.xjb) This useful when you may not modify
+                      xsd files because they are generated by other person or machine.
+                 -->
+                 <dependency>
+                     <groupId>org.jvnet.jaxb2_commons</groupId>
+                     <artifactId>jaxb2-basics</artifactId>
+                     <version>0.9.4</version>
+                 </dependency>
+
+                 <!-- We make this plugin work with this jaxb2 version.
+                      This particular version let us generate annotated classes using
+                      the -Xannotate argument.
+
+                      DO NOT FORGET: We can use <annox:annotate> in xsd files or by means 
+                      of custom bindings like I did with <inheritance:implements> (see custombinding.xjb)
+                      This useful when you may not modify xsd files because they are generated
+                      by other person or machine.
+                 -->
+                 <dependency>
+                     <groupId>org.jvnet.jaxb2_commons</groupId>
+                     <artifactId>jaxb2-basics-annotate</artifactId>
+                     <version>1.0.1</version>
+                 </dependency>
+             </dependencies>
+         </plugin>
+        <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.9.1</version>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>${project.xsd.schemas.target.path}</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+          </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <version>2.6</version>
+        <configuration>
+            <webResources>
+                <resource>
+                    <filtering>true</filtering>
+                    <directory>src/main/webapp</directory>
+                    <includes>
+                        <include>WEB-INF/web.xml</include>
+                    </includes>
+                </resource>
+            </webResources>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.eclipse.jetty</groupId>
+        <artifactId>jetty-maven-plugin</artifactId>
+        <version>${jetty.version}</version>
+        <configuration>
+          <jettyXml>${basedir}/src/main/jetty/jetty-http.xml</jettyXml>
+        </configuration>
+      </plugin> 
+    </plugins>
+  </build>
+</project>
diff --git a/web-services-spring-server/src/main/java/de/spring/webservices/business/CustomBindingBusinessExample.java b/web-services-spring-server/src/main/java/de/spring/webservices/business/CustomBindingBusinessExample.java
new file mode 100644 (file)
index 0000000..3d5646e
--- /dev/null
@@ -0,0 +1,25 @@
+package de.spring.webservices.business;
+
+import org.springframework.stereotype.Service;
+
+import de.spring.webservices.auto.CustomBindingExampleRequest;
+import de.spring.webservices.auto.CustomBindingExampleResponse;
+import de.spring.webservices.operations.Operations;
+
+
+@Service("customBindingBusinessExample")
+public class CustomBindingBusinessExample implements
+       Operations.RequestResponse<CustomBindingExampleResponse, CustomBindingExampleRequest> {
+
+       
+       @Override
+    public CustomBindingExampleResponse requestResponse(
+               final CustomBindingExampleRequest request) {
+        final CustomBindingExampleResponse response = new CustomBindingExampleResponse();
+
+        response.setData("CUSTOM BINDING SNAKE EYES AND " + request.getData());
+
+        return response;
+    }
+
+}
diff --git a/web-services-spring-server/src/main/java/de/spring/webservices/endpoints/ExampleEndPoint.java b/web-services-spring-server/src/main/java/de/spring/webservices/endpoints/ExampleEndPoint.java
new file mode 100644 (file)
index 0000000..6a91779
--- /dev/null
@@ -0,0 +1,56 @@
+package de.spring.webservices.endpoints;
+
+import org.jdom2.Element;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.ws.context.MessageContext;
+import org.springframework.ws.server.endpoint.annotation.Endpoint;
+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;
+
+
+@Endpoint
+public class ExampleEndPoint {
+    private static final String NAMESPACE_URI = "http://gumartinm.name/spring-ws/example";
+    
+    private final Operations.RequestResponse
+       <CustomBindingExampleResponse, CustomBindingExampleRequest> customBindingExample;  
+    
+    @Autowired
+       public ExampleEndPoint(
+            RequestResponse<CustomBindingExampleResponse, CustomBindingExampleRequest> customBindingExample) {
+           this.customBindingExample = customBindingExample;
+    }
+       
+    @PayloadRoot(localPart = "ExampleRequest", namespace = NAMESPACE_URI)
+    @ResponsePayload
+    public ExampleResponse order(
+            @RequestPayload final ExampleRequest requestObject,
+            @RequestPayload final Element element,
+            final MessageContext messageContext) {
+
+       final ExampleResponse response = new ExampleResponse();
+
+        response.setData("SNAKE EYES AND " + requestObject.getData());
+
+        return response;
+    }
+    
+    @PayloadRoot(localPart = "CustomBindingExampleRequest", namespace = NAMESPACE_URI)
+    @ResponsePayload
+    public CustomBindingExampleResponse order(
+            @RequestPayload final CustomBindingExampleRequest requestObject,
+            @RequestPayload final Element element,
+            final MessageContext messageContext) {
+
+        return this.customBindingExample.requestResponse(requestObject);
+    }
+}
+
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
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-server/src/main/java/de/spring/webservices/operations/Request.java b/web-services-spring-server/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-server/src/main/java/de/spring/webservices/operations/Response.java b/web-services-spring-server/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/jetty/jetty-http.xml b/web-services-spring-server/src/main/jetty/jetty-http.xml
new file mode 100644 (file)
index 0000000..d995630
--- /dev/null
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
+
+<!-- ============================================================= -->
+<!-- Configure the Jetty Server instance with an ID "Server"       -->
+<!-- by adding a HTTP connector.                                   -->
+<!-- This configuration must be used in conjunction with jetty.xml -->
+<!-- ============================================================= -->
+<Configure id="Server" class="org.eclipse.jetty.server.Server">
+
+ <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
+  <Set name="secureScheme">https</Set>
+  <Set name="securePort">
+    <Property name="jetty.secure.port" default="8443" />
+  </Set>
+  <Set name="outputBufferSize">32768</Set>
+  <Set name="requestHeaderSize">8192</Set>
+  <Set name="responseHeaderSize">8192</Set>
+  <Set name="sendServerVersion">true</Set>
+  <Set name="sendDateHeader">false</Set>
+  <Set name="headerCacheSize">512</Set>
+
+  <!-- Uncomment to enable handling of X-Forwarded- style headers
+  <Call name="addCustomizer">
+    <Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg>
+  </Call>
+  -->
+ </New>
+
+
+  <!-- =========================================================== -->
+  <!-- Add a HTTP Connector.                                       -->
+  <!-- Configure an o.e.j.server.ServerConnector with a single     -->
+  <!-- HttpConnectionFactory instance using the common httpConfig  -->
+  <!-- instance defined in jetty.xml                               -->
+  <!--                                                             -->
+  <!-- Consult the javadoc of o.e.j.server.ServerConnector and     -->
+  <!-- o.e.j.server.HttpConnectionFactory for all configuration    -->
+  <!-- that may be set here.                                       -->
+  <!-- =========================================================== -->
+  <Call name="addConnector">
+    <Arg>
+      <New class="org.eclipse.jetty.server.ServerConnector">
+        <Arg name="server">
+            <Ref refid="Server" />
+        </Arg>
+        <Arg name="factories">
+          <Array type="org.eclipse.jetty.server.ConnectionFactory">
+            <Item>
+              <New class="org.eclipse.jetty.server.HttpConnectionFactory">
+                <Arg name="config">
+                  <Ref refid="httpConfig" />
+                </Arg>
+              </New>
+            </Item>
+          </Array>
+        </Arg>
+        <Set name="host">
+          <Property name="jetty.host" default="127.0.0.1"/>
+        </Set>
+        <Set name="port">
+          <Property name="jetty.port" default="8080" />
+        </Set>
+        <Set name="idleTimeout">
+          <Property name="http.timeout" default="30000"/>
+        </Set>
+      </New>
+    </Arg>
+  </Call>
+
+</Configure>
diff --git a/web-services-spring-server/src/main/resources/bindings/custombinding.xjb b/web-services-spring-server/src/main/resources/bindings/custombinding.xjb
new file mode 100644 (file)
index 0000000..eea1cfe
--- /dev/null
@@ -0,0 +1,42 @@
+<?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-server/src/main/resources/log4j2.xml b/web-services-spring-server/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-server/src/main/resources/spring-configuration/spring-configuration.xml b/web-services-spring-server/src/main/resources/spring-configuration/spring-configuration.xml
new file mode 100644 (file)
index 0000000..7341c77
--- /dev/null
@@ -0,0 +1,14 @@
+<?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: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/util 
+                      http://www.springframework.org/schema/util/spring-util.xsd">
+
+</beans>
diff --git a/web-services-spring-server/src/main/resources/spring-configuration/ws/soap-ws.xml b/web-services-spring-server/src/main/resources/spring-configuration/ws/soap-ws.xml
new file mode 100644 (file)
index 0000000..0f7854c
--- /dev/null
@@ -0,0 +1,91 @@
+<?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: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/web-services 
+                      http://www.springframework.org/schema/web-services/web-services.xsd
+                      http://www.springframework.org/schema/context 
+                      http://www.springframework.org/schema/context/spring-context.xsd
+                      http://www.springframework.org/schema/util 
+                      http://www.springframework.org/schema/util/spring-util.xsd">
+
+       <!-- Searches for @Endpoint  --> 
+    <context:component-scan base-package="de.spring.webservices"/>
+
+    <!--
+        Aqui se podría especificar un unmarshaller (para la request) o un
+        marshaller (para la response) especifico. Por ejemplo Castor.
+        
+        Por la anotacion que uso para el EndPoint y porque tengo JAXB2 en el
+        classpath, Spring lo que está haciendo es el equivalente a si se 
+        escribiera lo siguiente:
+        
+        <oxm:jaxb2-marshaller id="marshaller" context-path="de.spring.webservices.auto"/>
+        
+         Searches for @PayloadRoot
+        <sws:annotation-driven marshaller="marshaller" unmarshaller="marshaller"/>
+     -->
+    <sws:annotation-driven/>
+
+    <!--
+        Spring makes the WSDL file for us from the XSD file.
+        Launch the Jetty server and download WSDL file from this URL:
+        http://localhost:8080/web-services-spring-server/spring-ws/example/example.wsdl
+    -->
+    <sws:dynamic-wsdl id="example" portTypeName="Examples"
+        createSoap12Binding="true" createSoap11Binding="false"
+        locationUri="/spring-ws/example"
+        targetNamespace="http://gumartinm.name/spring-ws/example">
+        <sws:xsd location="classpath:xsd/examples.xsd"/>
+    </sws:dynamic-wsdl>
+
+
+    <!-- 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="exceptionResolver"
+        class="org.springframework.ws.soap.server.endpoint.SoapFaultMappingExceptionResolver">
+        <property name="defaultFault" value="SERVER"/>
+        <property name="exceptionMappings">
+            <value>
+                org.springframework.oxm.ValidationFailureException=CLIENT,Invalid request
+            </value>
+        </property>
+    </bean>
+    
+</beans>
diff --git a/web-services-spring-server/src/main/resources/xsd/examples.xsd b/web-services-spring-server/src/main/resources/xsd/examples.xsd
new file mode 100644 (file)
index 0000000..7f431c6
--- /dev/null
@@ -0,0 +1,60 @@
+<?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>
diff --git a/web-services-spring-server/src/main/webapp/WEB-INF/web.xml b/web-services-spring-server/src/main/webapp/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..7e14eba
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+         version="2.4">
+
+    <display-name>Spring Web Services: example</display-name>
+
+    <listener>
+        <listener-class>
+            org.springframework.web.context.ContextLoaderListener
+        </listener-class>
+    </listener>
+
+    <context-param>
+        <param-name>spring.profiles.active</param-name>
+        <param-value>${environment.profile}</param-value>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>
+            classpath*:spring-configuration/*.xml
+        </param-value>
+    </context-param>
+
+    <!-- Spring SOAP servlet -->
+    <servlet>
+        <servlet-name>spring-ws</servlet-name>
+        <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+        <async-supported>true</async-supported>
+        <init-param>
+            <param-name>contextConfigLocation</param-name>
+            <param-value>classpath*:spring-configuration/ws/*.xml</param-value>
+        </init-param>
+        <init-param>
+            <param-name>transformWsdlLocations</param-name>
+            <param-value>true</param-value>
+        </init-param>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>spring-ws</servlet-name>
+        <url-pattern>/spring-ws/*</url-pattern>
+    </servlet-mapping>
+
+</web-app>
diff --git a/web-services-spring-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointIntegrationTest.java b/web-services-spring-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointIntegrationTest.java
new file mode 100644 (file)
index 0000000..7832cb1
--- /dev/null
@@ -0,0 +1,47 @@
+package de.spring.webservices.endpoints;
+
+import static org.springframework.ws.test.server.RequestCreators.withPayload;
+import static org.springframework.ws.test.server.ResponseMatchers.payload;
+
+import javax.xml.transform.Source;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.ws.test.server.MockWebServiceClient;
+import org.springframework.xml.transform.StringSource;
+
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("/spring-configuration.xml")
+public class ExampleEndPointIntegrationTest {
+
+    @Autowired
+    private ApplicationContext applicationContext;
+
+    private MockWebServiceClient mockClient;
+
+    @Before
+    public void createClient() {
+        mockClient = MockWebServiceClient.createClient(applicationContext);
+    }
+
+    @Test
+    public void exampleEndpoint() throws Exception {
+        final Source requestPayload = new StringSource(
+                "<ExampleRequest xmlns='http://gumartinm.name/spring-ws/example'>" +
+                        "<data>SCARLETT</data>" +
+                "</ExampleRequest>");
+        final Source responsePayload = new StringSource(
+                "<ns2:ExampleResponse xmlns:ns2='http://gumartinm.name/spring-ws/example'>" +
+                        "<ns2:data>SNAKE EYES AND SCARLETT</ns2:data>" +
+                "</ns2:ExampleResponse>");
+        mockClient.sendRequest(withPayload(requestPayload)).andExpect(
+                payload(responsePayload));
+    }
+}
+
diff --git a/web-services-spring/pom.xml b/web-services-spring/pom.xml
new file mode 100644 (file)
index 0000000..c1085dd
--- /dev/null
@@ -0,0 +1,142 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>de.spring.webservices</groupId>
+  <artifactId>web-services-spring</artifactId>
+  <packaging>pom</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>web-services-spring</name>
+  <url>http://gumartinm.name</url>
+  <description>Web Services Spring Framework</description>
+  <organization>
+    <name>Gustavo Martin Morcuende</name>
+    <url>http://www.gumartinm.name</url>
+  </organization>
+  <scm>
+    <developerConnection>scm:git:http://git.gumartinm.name/SpringWebServicesForFun</developerConnection>
+    <url>http://git.gumartinm.name/SpringWebServicesForFun</url>
+  </scm>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <!-- Be aware: spring-ws latest version does not follow spring-context latest version -->
+    <spring.version>4.0.9.RELEASE</spring.version>
+    <spring.ws.version>2.2.1.RELEASE</spring.ws.version>
+  </properties>
+
+  <profiles>
+    <profile>
+        <id>release</id>
+        <properties>
+            <environment.profile>release</environment.profile>
+        </properties>
+        <activation>
+            <activeByDefault>true</activeByDefault>
+        </activation>
+    </profile>
+  </profiles>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <version>2.3</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <version>2.3</version>
+    </dependency>
+    <dependency>
+      <groupId>cglib</groupId>
+      <artifactId>cglib</artifactId>
+      <version>2.2.2</version>
+    </dependency>
+  </dependencies>
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.springframework.ws</groupId>
+        <artifactId>spring-ws-core</artifactId>
+        <version>${spring.ws.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework.ws</groupId>
+        <artifactId>spring-xml</artifactId>
+        <version>${spring.ws.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jdom</groupId>
+        <artifactId>jdom</artifactId>
+        <version>2.0.2</version>
+      </dependency>
+
+      <!-- Required by spring-ws-core -->
+      <dependency>
+        <groupId>wsdl4j</groupId>
+        <artifactId>wsdl4j</artifactId>
+        <version>1.6.3</version>
+      </dependency>
+
+      <!-- Unitary and integration tests --> 
+      <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>4.12</version>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-test</artifactId>
+        <version>${spring.version}</version>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework.ws</groupId>
+        <artifactId>spring-ws-test</artifactId>
+        <version>${spring.ws.version}</version>
+        <scope>test</scope>
+      </dependency>
+   </dependencies>
+  </dependencyManagement>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.3</version>
+        <configuration>
+            <source>1.8</source>
+            <target>1.8</target>
+            <encoding>${project.build.sourceEncoding}</encoding>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>2.7</version>
+        <configuration>
+          <encoding>${project.build.sourceEncoding}</encoding>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.4</version>
+        <configuration>
+          <archive>
+            <manifestEntries>
+              <Specification-Title>${project.description}</Specification-Title>
+              <Specification-Version>${project.version}</Specification-Version>
+              <Specification-Vendor>${project.organization.name}</Specification-Vendor>
+              <Implementation-Title>${project.description}</Implementation-Title>
+              <Implementation-Version>${project.version}</Implementation-Version>
+              <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
+            </manifestEntries>
+          </archive>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>