From ea28ddfd1aa4c247a88e8f999a25567da617b3c4 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Sun, 13 Dec 2015 19:01:25 +0100 Subject: [PATCH] Preparing to test jaxb2 plugin --- cxf/web-services-spring-cxf-client/pom.xml | 184 +++++++++++++++++ .../build-resources/bindings/custombinding.xjb | 50 +++++ .../src/main/build-resources/catalogs/catalog.cat | 38 ++++ .../src/main/build-resources/wsdl/example.wsdl | 143 +++++++++++++ .../webservices/client/ExampleClientService.java | 72 +++++++ .../de/spring/webservices/client/MainTest.java | 52 +++++ .../src/main/resources/examples.xsd | 92 +++++++++ .../src/main/resources/log4j2.xml | 14 ++ .../ws/client-spring-configuration.xml | 96 +++++++++ .../ExampleClientServiceIntegrationTest.java | 78 ++++++++ cxf/web-services-spring-cxf-globalxsds/pom.xml | 101 ++++++++++ .../build-resources/bindings/custombinding.xjb | 8 + .../binders/XSDateTimeCustomBinder.java | 35 ++++ .../spring/webservices/operations/Operations.java | 111 +++++++++++ .../de/spring/webservices/operations/Request.java | 5 + .../de/spring/webservices/operations/Response.java | 5 + .../src/main/resources/parent.xsd | 16 ++ cxf/web-services-spring-cxf-server/pom.xml | 221 +++++++++++++++++++++ .../build-resources/bindings/custombinding.xjb | 51 +++++ .../src/main/build-resources/catalogs/catalog.cat | 38 ++++ .../webservices/endpoints/ExampleEndPoint.java | 57 ++++++ .../webservices/services/ExampleService.java | 11 + .../impl/CustomBindingExampleServiceImpl.java | 27 +++ .../services/impl/ExampleServiceImpl.java | 23 +++ .../src/main/jetty/jetty-http.xml | 71 +++++++ .../src/main/resources/examples.xsd | 92 +++++++++ .../src/main/resources/log4j2.xml | 14 ++ .../spring-configuration/spring-configuration.xml | 14 ++ .../resources/spring-configuration/ws/soap-ws.xml | 101 ++++++++++ .../src/main/webapp/WEB-INF/web.xml | 44 ++++ .../endpoints/ExampleEndPointIntegrationTest.java | 62 ++++++ .../webservices/endpoints/ExampleEndPointTest.java | 52 +++++ .../services/CustomBindingExampleServiceTest.java | 34 ++++ .../webservices/services/ExampleServiceTest.java | 32 +++ cxf/web-services-spring-cxf/pom.xml | 191 ++++++++++++++++++ web-services-spring-client/pom.xml | 184 ----------------- .../build-resources/bindings/custombinding.xjb | 50 ----- .../src/main/build-resources/catalogs/catalog.cat | 38 ---- .../src/main/build-resources/wsdl/example.wsdl | 143 ------------- .../webservices/client/ExampleClientService.java | 72 ------- .../de/spring/webservices/client/MainTest.java | 52 ----- .../src/main/resources/examples.xsd | 92 --------- .../src/main/resources/log4j2.xml | 14 -- .../ws/client-spring-configuration.xml | 96 --------- .../ExampleClientServiceIntegrationTest.java | 78 -------- web-services-spring-globalxsds/pom.xml | 101 ---------- .../build-resources/bindings/custombinding.xjb | 8 - .../binders/XSDateTimeCustomBinder.java | 35 ---- .../spring/webservices/operations/Operations.java | 111 ----------- .../de/spring/webservices/operations/Request.java | 5 - .../de/spring/webservices/operations/Response.java | 5 - .../src/main/resources/parent.xsd | 16 -- web-services-spring-server/pom.xml | 221 --------------------- .../build-resources/bindings/custombinding.xjb | 51 ----- .../src/main/build-resources/catalogs/catalog.cat | 38 ---- .../webservices/endpoints/ExampleEndPoint.java | 57 ------ .../webservices/services/ExampleService.java | 11 - .../impl/CustomBindingExampleServiceImpl.java | 27 --- .../services/impl/ExampleServiceImpl.java | 23 --- .../src/main/jetty/jetty-http.xml | 71 ------- .../src/main/resources/examples.xsd | 92 --------- .../src/main/resources/log4j2.xml | 14 -- .../spring-configuration/spring-configuration.xml | 14 -- .../resources/spring-configuration/ws/soap-ws.xml | 101 ---------- .../src/main/webapp/WEB-INF/web.xml | 44 ---- .../endpoints/ExampleEndPointIntegrationTest.java | 62 ------ .../webservices/endpoints/ExampleEndPointTest.java | 52 ----- .../services/CustomBindingExampleServiceTest.java | 34 ---- .../webservices/services/ExampleServiceTest.java | 32 --- web-services-spring/pom.xml | 191 ------------------ 70 files changed, 2235 insertions(+), 2235 deletions(-) create mode 100644 cxf/web-services-spring-cxf-client/pom.xml create mode 100644 cxf/web-services-spring-cxf-client/src/main/build-resources/bindings/custombinding.xjb create mode 100644 cxf/web-services-spring-cxf-client/src/main/build-resources/catalogs/catalog.cat create mode 100644 cxf/web-services-spring-cxf-client/src/main/build-resources/wsdl/example.wsdl create mode 100644 cxf/web-services-spring-cxf-client/src/main/java/de/spring/webservices/client/ExampleClientService.java create mode 100644 cxf/web-services-spring-cxf-client/src/main/java/de/spring/webservices/client/MainTest.java create mode 100644 cxf/web-services-spring-cxf-client/src/main/resources/examples.xsd create mode 100644 cxf/web-services-spring-cxf-client/src/main/resources/log4j2.xml create mode 100644 cxf/web-services-spring-cxf-client/src/main/resources/spring-configuration/ws/client-spring-configuration.xml create mode 100644 cxf/web-services-spring-cxf-client/src/test/java/de/spring/webservices/client/ExampleClientServiceIntegrationTest.java create mode 100644 cxf/web-services-spring-cxf-globalxsds/pom.xml create mode 100644 cxf/web-services-spring-cxf-globalxsds/src/main/build-resources/bindings/custombinding.xjb create mode 100644 cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/binders/XSDateTimeCustomBinder.java create mode 100644 cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/operations/Operations.java create mode 100644 cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/operations/Request.java create mode 100644 cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/operations/Response.java create mode 100644 cxf/web-services-spring-cxf-globalxsds/src/main/resources/parent.xsd create mode 100644 cxf/web-services-spring-cxf-server/pom.xml create mode 100644 cxf/web-services-spring-cxf-server/src/main/build-resources/bindings/custombinding.xjb create mode 100644 cxf/web-services-spring-cxf-server/src/main/build-resources/catalogs/catalog.cat create mode 100644 cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/endpoints/ExampleEndPoint.java create mode 100644 cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/services/ExampleService.java create mode 100644 cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/services/impl/CustomBindingExampleServiceImpl.java create mode 100644 cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/services/impl/ExampleServiceImpl.java create mode 100644 cxf/web-services-spring-cxf-server/src/main/jetty/jetty-http.xml create mode 100644 cxf/web-services-spring-cxf-server/src/main/resources/examples.xsd create mode 100644 cxf/web-services-spring-cxf-server/src/main/resources/log4j2.xml create mode 100644 cxf/web-services-spring-cxf-server/src/main/resources/spring-configuration/spring-configuration.xml create mode 100644 cxf/web-services-spring-cxf-server/src/main/resources/spring-configuration/ws/soap-ws.xml create mode 100644 cxf/web-services-spring-cxf-server/src/main/webapp/WEB-INF/web.xml create mode 100644 cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointIntegrationTest.java create mode 100644 cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointTest.java create mode 100644 cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/services/CustomBindingExampleServiceTest.java create mode 100644 cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/services/ExampleServiceTest.java create mode 100644 cxf/web-services-spring-cxf/pom.xml delete mode 100644 web-services-spring-client/pom.xml delete mode 100644 web-services-spring-client/src/main/build-resources/bindings/custombinding.xjb delete mode 100644 web-services-spring-client/src/main/build-resources/catalogs/catalog.cat delete mode 100644 web-services-spring-client/src/main/build-resources/wsdl/example.wsdl delete mode 100644 web-services-spring-client/src/main/java/de/spring/webservices/client/ExampleClientService.java delete mode 100644 web-services-spring-client/src/main/java/de/spring/webservices/client/MainTest.java delete mode 100644 web-services-spring-client/src/main/resources/examples.xsd delete mode 100644 web-services-spring-client/src/main/resources/log4j2.xml delete mode 100644 web-services-spring-client/src/main/resources/spring-configuration/ws/client-spring-configuration.xml delete mode 100644 web-services-spring-client/src/test/java/de/spring/webservices/client/ExampleClientServiceIntegrationTest.java delete mode 100644 web-services-spring-globalxsds/pom.xml delete mode 100644 web-services-spring-globalxsds/src/main/build-resources/bindings/custombinding.xjb delete mode 100644 web-services-spring-globalxsds/src/main/java/de/spring/webservices/binders/XSDateTimeCustomBinder.java delete mode 100644 web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Operations.java delete mode 100644 web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Request.java delete mode 100644 web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Response.java delete mode 100644 web-services-spring-globalxsds/src/main/resources/parent.xsd delete mode 100644 web-services-spring-server/pom.xml delete mode 100644 web-services-spring-server/src/main/build-resources/bindings/custombinding.xjb delete mode 100644 web-services-spring-server/src/main/build-resources/catalogs/catalog.cat delete mode 100644 web-services-spring-server/src/main/java/de/spring/webservices/endpoints/ExampleEndPoint.java delete mode 100644 web-services-spring-server/src/main/java/de/spring/webservices/services/ExampleService.java delete mode 100644 web-services-spring-server/src/main/java/de/spring/webservices/services/impl/CustomBindingExampleServiceImpl.java delete mode 100644 web-services-spring-server/src/main/java/de/spring/webservices/services/impl/ExampleServiceImpl.java delete mode 100644 web-services-spring-server/src/main/jetty/jetty-http.xml delete mode 100644 web-services-spring-server/src/main/resources/examples.xsd delete mode 100644 web-services-spring-server/src/main/resources/log4j2.xml delete mode 100644 web-services-spring-server/src/main/resources/spring-configuration/spring-configuration.xml delete mode 100644 web-services-spring-server/src/main/resources/spring-configuration/ws/soap-ws.xml delete mode 100644 web-services-spring-server/src/main/webapp/WEB-INF/web.xml delete mode 100644 web-services-spring-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointIntegrationTest.java delete mode 100644 web-services-spring-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointTest.java delete mode 100644 web-services-spring-server/src/test/java/de/spring/webservices/services/CustomBindingExampleServiceTest.java delete mode 100644 web-services-spring-server/src/test/java/de/spring/webservices/services/ExampleServiceTest.java delete mode 100644 web-services-spring/pom.xml diff --git a/cxf/web-services-spring-cxf-client/pom.xml b/cxf/web-services-spring-cxf-client/pom.xml new file mode 100644 index 0000000..31cf961 --- /dev/null +++ b/cxf/web-services-spring-cxf-client/pom.xml @@ -0,0 +1,184 @@ + + 4.0.0 + + web-services-spring-cxf + de.spring.webservices + 1.0-SNAPSHOT + + web-services-spring-cxf-client + web-services-spring-cxf-client + http://gumartinm.name + + + src/main/build-resources/wsdl + ${basedir}/target/generated-sources/src/main/java + src/main/build-resources/bindings + + ${basedir}/src/main/build-resources/catalogs + + + + + org.springframework.ws + spring-ws-core + + + org.springframework.ws + spring-xml + + + org.jdom + jdom + + + + + + de.spring.webservices + web-services-spring-cxf-globalxsds + ${project.version} + + + + + + wsdl4j + wsdl4j + + + + + org.jvnet.jaxb2_commons + jaxb2-basics-runtime + 0.9.4 + + + + + junit + junit + test + + + org.springframework + spring-test + test + + + org.springframework.ws + spring-ws-test + test + + + + + ${project.artifactId} + + + ${basedir}/src/main/resources/ + + **/*.* + + + + + + + org.apache.cxf + cxf-codegen-plugin + 3.1.0 + + + generate-sources-from-wsdl + generate-sources + + wsdl2java + + + true + ${project.wsdl.target.path} + + + + ${project.wsdl.sources.path}/example.wsdl + + ${project.bindings.path}/custombinding.xjb + + + -xjc-Xinheritance + -xjc-Xannotate + -catalog + ${project.catalogs.path}/catalog.cat + -verbose + + + + + + + + + + org.jvnet.jaxb2_commons + jaxb2-basics + 0.9.4 + + + + + org.jvnet.jaxb2_commons + jaxb2-basics-annotate + 1.0.1 + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + ${project.wsdl.target.path} + + + + + + + + + diff --git a/cxf/web-services-spring-cxf-client/src/main/build-resources/bindings/custombinding.xjb b/cxf/web-services-spring-cxf-client/src/main/build-resources/bindings/custombinding.xjb new file mode 100644 index 0000000..95e1fd2 --- /dev/null +++ b/cxf/web-services-spring-cxf-client/src/main/build-resources/bindings/custombinding.xjb @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + de.spring.webservices.operations.Request + @java.lang.suppresswarnings({"unchecked","rawtypes"}) + + + + de.spring.webservices.operations.Response + @java.lang.suppresswarnings({"unchecked","rawtypes"}) + + + + + + + + + diff --git a/cxf/web-services-spring-cxf-client/src/main/build-resources/catalogs/catalog.cat b/cxf/web-services-spring-cxf-client/src/main/build-resources/catalogs/catalog.cat new file mode 100644 index 0000000..4bc1c66 --- /dev/null +++ b/cxf/web-services-spring-cxf-client/src/main/build-resources/catalogs/catalog.cat @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/cxf/web-services-spring-cxf-client/src/main/build-resources/wsdl/example.wsdl b/cxf/web-services-spring-cxf-client/src/main/build-resources/wsdl/example.wsdl new file mode 100644 index 0000000..02b2256 --- /dev/null +++ b/cxf/web-services-spring-cxf-client/src/main/build-resources/wsdl/example.wsdl @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + @java.lang.SuppressWarnings({"unchecked","rawtypes"}) + de.spring.webservices.operations.Request + + + + + + + + + + + + de.spring.webservices.operations.Response + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cxf/web-services-spring-cxf-client/src/main/java/de/spring/webservices/client/ExampleClientService.java b/cxf/web-services-spring-cxf-client/src/main/java/de/spring/webservices/client/ExampleClientService.java new file mode 100644 index 0000000..177c13e --- /dev/null +++ b/cxf/web-services-spring-cxf-client/src/main/java/de/spring/webservices/client/ExampleClientService.java @@ -0,0 +1,72 @@ +package de.spring.webservices.client; + +import name.gumartinm.spring_ws.parent.ParentEnumType; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.ws.client.core.WebServiceTemplate; + +import de.spring.webservices.auto.CustomBindingExampleRequest; +import de.spring.webservices.auto.CustomBindingExampleResponse; +import de.spring.webservices.auto.ExampleRequest; +import de.spring.webservices.auto.ExampleResponse; +import de.spring.webservices.auto.Examples; +import de.spring.webservices.auto.ExamplesService; + +/** + * Someone could write code like this one in order to send and receive + * information from our Web Services. + * + */ +public class ExampleClientService { + 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."); + customBindingxampleRequest.setParentEnum(ParentEnumType.FIRST); + + 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/cxf/web-services-spring-cxf-client/src/main/java/de/spring/webservices/client/MainTest.java b/cxf/web-services-spring-cxf-client/src/main/java/de/spring/webservices/client/MainTest.java new file mode 100644 index 0000000..48fbdcd --- /dev/null +++ b/cxf/web-services-spring-cxf-client/src/main/java/de/spring/webservices/client/MainTest.java @@ -0,0 +1,52 @@ +package de.spring.webservices.client; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import de.spring.webservices.auto.CustomBindingExampleResponse; +import de.spring.webservices.auto.ExampleResponse; + +/** + * This class is used just like a nice example about how to write and run client + * code which will send data to and from the Web Services. + * + */ +public class MainTest { + private static final Logger logger = LoggerFactory.getLogger(MainTest.class); + + public ApplicationContext context; + + /** + * @param args + */ + public static void main(final String[] args) { + final MainTest test = new MainTest(); + + test.context = new ClassPathXmlApplicationContext( + "classpath:spring-configuration/ws/client-spring-configuration.xml"); + + final ExampleClientService example = + (ExampleClientService) test.context.getBean("exampleClient"); + + logger.info("ExampleResponse Java:"); + ExampleResponse response = example.sendAndReceiveJava(); + logger.info(response.getData()); + + + logger.info("CustomBindingExampleResponse Java:"); + CustomBindingExampleResponse customBindingResponse = example.sendAndReceiveJavaCustom(); + logger.info(customBindingResponse.getData()); + + + logger.info("ExampleResponse Spring:"); + response = example.sendAndReceiveSpring(); + logger.info(response.getData()); + + + logger.info("CustomBindingExampleResponse Spring:"); + customBindingResponse = example.sendAndReceiveSpringCustom(); + logger.info(customBindingResponse.getData()); + } +} diff --git a/cxf/web-services-spring-cxf-client/src/main/resources/examples.xsd b/cxf/web-services-spring-cxf-client/src/main/resources/examples.xsd new file mode 100644 index 0000000..96c3737 --- /dev/null +++ b/cxf/web-services-spring-cxf-client/src/main/resources/examples.xsd @@ -0,0 +1,92 @@ + + + + + + + + + + + + + @java.lang.SuppressWarnings({"unchecked","rawtypes"}) + de.spring.webservices.operations.Request + + + + + + + + + + + + de.spring.webservices.operations.Response + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cxf/web-services-spring-cxf-client/src/main/resources/log4j2.xml b/cxf/web-services-spring-cxf-client/src/main/resources/log4j2.xml new file mode 100644 index 0000000..18a4008 --- /dev/null +++ b/cxf/web-services-spring-cxf-client/src/main/resources/log4j2.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/cxf/web-services-spring-cxf-client/src/main/resources/spring-configuration/ws/client-spring-configuration.xml b/cxf/web-services-spring-cxf-client/src/main/resources/spring-configuration/ws/client-spring-configuration.xml new file mode 100644 index 0000000..785d2db --- /dev/null +++ b/cxf/web-services-spring-cxf-client/src/main/resources/spring-configuration/ws/client-spring-configuration.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + classpath:examples.xsd + classpath:parent.xsd + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cxf/web-services-spring-cxf-client/src/test/java/de/spring/webservices/client/ExampleClientServiceIntegrationTest.java b/cxf/web-services-spring-cxf-client/src/test/java/de/spring/webservices/client/ExampleClientServiceIntegrationTest.java new file mode 100644 index 0000000..a536c47 --- /dev/null +++ b/cxf/web-services-spring-cxf-client/src/test/java/de/spring/webservices/client/ExampleClientServiceIntegrationTest.java @@ -0,0 +1,78 @@ +package de.spring.webservices.client; + +import static org.junit.Assert.assertEquals; +import static org.springframework.ws.test.client.RequestMatchers.payload; +import static org.springframework.ws.test.client.ResponseCreators.withPayload; + +import 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.client.core.WebServiceTemplate; +import org.springframework.ws.test.client.MockWebServiceServer; +import org.springframework.xml.transform.StringSource; + +import de.spring.webservices.auto.CustomBindingExampleResponse; +import de.spring.webservices.auto.ExampleResponse; + + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration("classpath*:spring-configuration/ws/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( + "" + + "SCARLETT SPRING. IT IS CANON." + + ""); + final Source responsePayload = new StringSource( + "" + + "SNAKE EYES AND SCARLETT SPRING. IT IS CANON." + + ""); + mockServer.expect(payload(requestPayload)).andRespond( + withPayload(responsePayload)); + + final ExampleResponse response = exampleClientService.sendAndReceiveSpring(); + + assertEquals(response.getData(), "SNAKE EYES AND SCARLETT SPRING. IT IS CANON."); + mockServer.verify(); + } + + @Test + public void customerCustomClient() throws Exception { + final Source customRequestPayload = new StringSource( + "" + + "CUSTOM BINDING SPRING. SCARLETT. IT IS CANON." + + ""); + final Source customResponsePayload = new StringSource( + "" + + "CUSTOM BINDING SNAKE EYES AND SCARLETT SPRING. IT IS CANON." + + ""); + mockServer.expect(payload(customRequestPayload)).andRespond( + withPayload(customResponsePayload)); + + final CustomBindingExampleResponse response = exampleClientService.sendAndReceiveSpringCustom(); + + assertEquals(response.getData(), "CUSTOM BINDING SNAKE EYES AND SCARLETT SPRING. IT IS CANON."); + mockServer.verify(); + } +} + diff --git a/cxf/web-services-spring-cxf-globalxsds/pom.xml b/cxf/web-services-spring-cxf-globalxsds/pom.xml new file mode 100644 index 0000000..c8b0db0 --- /dev/null +++ b/cxf/web-services-spring-cxf-globalxsds/pom.xml @@ -0,0 +1,101 @@ + + 4.0.0 + + web-services-spring-cxf + de.spring.webservices + 1.0-SNAPSHOT + + web-services-spring-cxf-globalxsds + web-services-spring-cxf-globalxsds + http://gumartinm.name + + + src/main/resources + ${basedir}/target/generated-sources/src/main/java + de.spring.webservices.auto + src/main/build-resources/bindings + + + + + + + junit + junit + test + + + + + ${project.artifactId} + + + ${basedir}/src/main/resources + + **/*.* + + + + + + + org.apache.cxf + cxf-xjc-plugin + 3.0.3 + + true + + org.apache.cxf.xjcplugins:cxf-xjc-dv:3.0.3 + + + + + generate-sources-from-xsd + generate-sources + + xsdtojava + + + ${project.xsd.schemas.target.path} + + + true + ${project.xsd.schemas.source.path}/parent.xsd + ${project.bindings.path}/custombinding.xjb + ${project.xsd.schemas.package.name} + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + ${project.xsd.schemas.target.path} + + + + + + + + diff --git a/cxf/web-services-spring-cxf-globalxsds/src/main/build-resources/bindings/custombinding.xjb b/cxf/web-services-spring-cxf-globalxsds/src/main/build-resources/bindings/custombinding.xjb new file mode 100644 index 0000000..8b4a110 --- /dev/null +++ b/cxf/web-services-spring-cxf-globalxsds/src/main/build-resources/bindings/custombinding.xjb @@ -0,0 +1,8 @@ + + + + + diff --git a/cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/binders/XSDateTimeCustomBinder.java b/cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/binders/XSDateTimeCustomBinder.java new file mode 100644 index 0000000..f39921a --- /dev/null +++ b/cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/binders/XSDateTimeCustomBinder.java @@ -0,0 +1,35 @@ +package de.spring.webservices.binders; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; + +import javax.xml.bind.annotation.adapters.XmlAdapter; + + +/** + * ATTENTION: if you are using this custombinder you will have to create custom payload + * validators for Spring (AS FAR AS I KNOW) + * + */ +public class XSDateTimeCustomBinder extends XmlAdapter { + + @Override + public Date unmarshal(final String dateTime) throws Exception { + // X pattern just works from Java >= 1.7 + final DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX"); + formatter.setTimeZone(TimeZone.getTimeZone("Europe/Madrid")); + + return formatter.parse(dateTime); + } + + @Override + public String marshal(final Date dateTime) throws Exception { + // X pattern just works from Java >= 1.7 + final DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX"); + formatter.setTimeZone(TimeZone.getTimeZone("Europe/Madrid")); + + return formatter.format(dateTime); + } +} diff --git a/cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/operations/Operations.java b/cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/operations/Operations.java new file mode 100644 index 0000000..13b5113 --- /dev/null +++ b/cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/operations/Operations.java @@ -0,0 +1,111 @@ +package de.spring.webservices.operations; + +/** + *

+ * Operations: WSDL v1.1 and v2.0 + *

+ * See: http://www.w3.org/TR/wsdl#_porttypes
+ * See: + * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns + * + */ +public interface Operations { + + /** + *

+ * Request-response operation WSDL v1.1 + *

+ * See: http://www.w3.org + * /TR/wsdl#_request-response + * + * @param + * Describes {@link Response} + * @param + * Describes {@link Request} + */ + public static interface RequestResponse { + T requestResponse(E request); + } + + /** + *

+ * One-way operation WSDL v1.1 + *

+ * See: http://www.w3.org/TR/wsdl + * #_one-way + * + * @param + * Describes {@link Response} + * @param + * Describes {@link Request} + */ + public interface OneWay { + void oneWay(E request); + } + + /** + *

+ * Notification operation WSDL v1.1 + *

+ * See: http://www.w3.org/TR + * /wsdl#_notification + * + * @param + * Describes {@link Response} + * @param + * Describes {@link Request} + */ + public interface Notification { + T notification(); + } + + /** + *

+ * In-Only message exchange pattern WSDL 2.0 + *

+ * See: + * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns + * + * @param + * Describes {@link Request} + */ + public interface InOnly { + void inOnly(E request); + } + + /** + *

+ * Robust In-Only message exchange pattern WSDL 2.0 + *

+ * See: + * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns + * + * @param + * Describes {@link Request} + */ + public interface RobustInOnly { + void robustInOnly(E request); + } + + /** + *

+ * In-Out message exchange pattern WSDL 2.0 + *

+ * See: + * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns + * + * @param + * Describes {@link Response} + * @param + * Describes {@link Request} + */ + public interface InOut { + T inOut(E request); + } +} \ No newline at end of file diff --git a/cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/operations/Request.java b/cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/operations/Request.java new file mode 100644 index 0000000..77d81f4 --- /dev/null +++ b/cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/operations/Request.java @@ -0,0 +1,5 @@ +package de.spring.webservices.operations; + +public interface Request { + +} diff --git a/cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/operations/Response.java b/cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/operations/Response.java new file mode 100644 index 0000000..3a2cbea --- /dev/null +++ b/cxf/web-services-spring-cxf-globalxsds/src/main/java/de/spring/webservices/operations/Response.java @@ -0,0 +1,5 @@ +package de.spring.webservices.operations; + +public interface Response { + +} diff --git a/cxf/web-services-spring-cxf-globalxsds/src/main/resources/parent.xsd b/cxf/web-services-spring-cxf-globalxsds/src/main/resources/parent.xsd new file mode 100644 index 0000000..0ce508e --- /dev/null +++ b/cxf/web-services-spring-cxf-globalxsds/src/main/resources/parent.xsd @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff --git a/cxf/web-services-spring-cxf-server/pom.xml b/cxf/web-services-spring-cxf-server/pom.xml new file mode 100644 index 0000000..b8c95e6 --- /dev/null +++ b/cxf/web-services-spring-cxf-server/pom.xml @@ -0,0 +1,221 @@ + + 4.0.0 + + web-services-spring-cxf + de.spring.webservices + 1.0-SNAPSHOT + + web-services-spring-cxf-server + war + web-services-spring-cxf-server + http://gumartinm.name + + + 9.3.0.RC0 + src/main/resources + ${basedir}/target/generated-sources/src/main/java + de.spring.webservices.auto + src/main/build-resources/bindings + + ${basedir}/src/main/build-resources/catalogs + + + + + org.springframework.ws + spring-ws-core + + + org.springframework.ws + spring-xml + + + org.jdom + jdom + + + + + + de.spring.webservices + web-services-spring-cxf-globalxsds + ${project.version} + + + + + + wsdl4j + wsdl4j + + + + + org.jvnet.jaxb2_commons + jaxb2-basics-runtime + 0.9.4 + + + + + junit + junit + test + + + org.springframework + spring-test + test + + + org.springframework.ws + spring-ws-test + test + + + org.mockito + mockito-core + test + + + + + ${project.artifactId} + + + ${basedir}/src/main/webapp + + **/*.* + + + + ${basedir}/src/main/resources/ + + **/*.* + + + + + + + org.apache.cxf + cxf-xjc-plugin + 3.0.3 + + true + + org.apache.cxf.xjcplugins:cxf-xjc-dv:3.0.3 + + + + + generate-sources-from-xsd + generate-sources + + xsdtojava + + + ${project.xsd.schemas.target.path} + + + true + ${project.xsd.schemas.source.path}/examples.xsd + ${project.bindings.path}/custombinding.xjb + ${project.catalogs.path}/catalog.cat + ${project.xsd.schemas.package.name} + + -Xinheritance + -Xannotate + + + + + + + + + + org.jvnet.jaxb2_commons + jaxb2-basics + 0.9.4 + + + + + org.jvnet.jaxb2_commons + jaxb2-basics-annotate + 1.0.1 + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + ${project.xsd.schemas.target.path} + + + + + + + org.apache.maven.plugins + maven-war-plugin + 2.6 + + + + true + src/main/webapp + + WEB-INF/web.xml + + + + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty.version} + + ${basedir}/src/main/jetty/jetty-http.xml + + + + + diff --git a/cxf/web-services-spring-cxf-server/src/main/build-resources/bindings/custombinding.xjb b/cxf/web-services-spring-cxf-server/src/main/build-resources/bindings/custombinding.xjb new file mode 100644 index 0000000..a1430d5 --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/main/build-resources/bindings/custombinding.xjb @@ -0,0 +1,51 @@ + + + + + + + + + de.spring.webservices.operations.Request + @java.lang.SuppressWarnings({"unchecked","rawtypes"}) + + + + + + + de.spring.webservices.operations.Response + @java.lang.SuppressWarnings({"unchecked","rawtypes"}) + + + + + + + + + + + diff --git a/cxf/web-services-spring-cxf-server/src/main/build-resources/catalogs/catalog.cat b/cxf/web-services-spring-cxf-server/src/main/build-resources/catalogs/catalog.cat new file mode 100644 index 0000000..4bc1c66 --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/main/build-resources/catalogs/catalog.cat @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/endpoints/ExampleEndPoint.java b/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/endpoints/ExampleEndPoint.java new file mode 100644 index 0000000..8fb4e40 --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/endpoints/ExampleEndPoint.java @@ -0,0 +1,57 @@ +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; +import de.spring.webservices.services.ExampleService; + + +@Endpoint +public class ExampleEndPoint { + private static final String NAMESPACE_URI = "http://gumartinm.name/spring-ws/example"; + + private final Operations.RequestResponse + customBindingExampleService; + + private final ExampleService exampleService; + + @Autowired + public ExampleEndPoint( + RequestResponse customBindingExampleService, + ExampleService exampleService) { + this.customBindingExampleService = customBindingExampleService; + this.exampleService = exampleService; + } + + @PayloadRoot(localPart = "ExampleRequest", namespace = NAMESPACE_URI) + @ResponsePayload + public ExampleResponse exampleResponse( + @RequestPayload final ExampleRequest request, + @RequestPayload final Element element, + final MessageContext messageContext) { + + return this.exampleService.doResponse(request); + } + + @PayloadRoot(localPart = "CustomBindingExampleRequest", namespace = NAMESPACE_URI) + @ResponsePayload + public CustomBindingExampleResponse cuntomBindingExampleResponse( + @RequestPayload final CustomBindingExampleRequest requestObject, + @RequestPayload final Element element, + final MessageContext messageContext) { + + return this.customBindingExampleService.requestResponse(requestObject); + } +} + diff --git a/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/services/ExampleService.java b/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/services/ExampleService.java new file mode 100644 index 0000000..9d7eb79 --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/services/ExampleService.java @@ -0,0 +1,11 @@ +package de.spring.webservices.services; + +import de.spring.webservices.auto.ExampleRequest; +import de.spring.webservices.auto.ExampleResponse; + + +public interface ExampleService { + + public ExampleResponse doResponse(ExampleRequest request); + +} diff --git a/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/services/impl/CustomBindingExampleServiceImpl.java b/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/services/impl/CustomBindingExampleServiceImpl.java new file mode 100644 index 0000000..caa7e41 --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/services/impl/CustomBindingExampleServiceImpl.java @@ -0,0 +1,27 @@ +package de.spring.webservices.services.impl; + +import org.springframework.stereotype.Service; + +import de.spring.webservices.auto.CustomBindingExampleRequest; +import de.spring.webservices.auto.CustomBindingExampleResponse; +import de.spring.webservices.auto.ParentEnumType; +import de.spring.webservices.operations.Operations; + + +@Service("customBindingExampleService") +public class CustomBindingExampleServiceImpl implements + Operations.RequestResponse { + + + @Override + public CustomBindingExampleResponse requestResponse(final CustomBindingExampleRequest request) { + + CustomBindingExampleResponse response = new CustomBindingExampleResponse(); + + response.setData("CUSTOM BINDING SNAKE EYES AND " + request.getData()); + response.setParentEnum(ParentEnumType.FIRST); + + return response; + } + +} diff --git a/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/services/impl/ExampleServiceImpl.java b/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/services/impl/ExampleServiceImpl.java new file mode 100644 index 0000000..7037776 --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/services/impl/ExampleServiceImpl.java @@ -0,0 +1,23 @@ +package de.spring.webservices.services.impl; + +import org.springframework.stereotype.Service; + +import de.spring.webservices.auto.ExampleRequest; +import de.spring.webservices.auto.ExampleResponse; +import de.spring.webservices.services.ExampleService; + + +@Service("exampleService") +public class ExampleServiceImpl implements ExampleService { + + @Override + public ExampleResponse doResponse(final ExampleRequest request) { + + ExampleResponse response = new ExampleResponse(); + + response.setData("SNAKE EYES AND " + request.getData()); + + return response; + } + +} diff --git a/cxf/web-services-spring-cxf-server/src/main/jetty/jetty-http.xml b/cxf/web-services-spring-cxf-server/src/main/jetty/jetty-http.xml new file mode 100644 index 0000000..d995630 --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/main/jetty/jetty-http.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + https + + + + 32768 + 8192 + 8192 + true + false + 512 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cxf/web-services-spring-cxf-server/src/main/resources/examples.xsd b/cxf/web-services-spring-cxf-server/src/main/resources/examples.xsd new file mode 100644 index 0000000..96c3737 --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/main/resources/examples.xsd @@ -0,0 +1,92 @@ + + + + + + + + + + + + + @java.lang.SuppressWarnings({"unchecked","rawtypes"}) + de.spring.webservices.operations.Request + + + + + + + + + + + + de.spring.webservices.operations.Response + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cxf/web-services-spring-cxf-server/src/main/resources/log4j2.xml b/cxf/web-services-spring-cxf-server/src/main/resources/log4j2.xml new file mode 100644 index 0000000..18a4008 --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/main/resources/log4j2.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/cxf/web-services-spring-cxf-server/src/main/resources/spring-configuration/spring-configuration.xml b/cxf/web-services-spring-cxf-server/src/main/resources/spring-configuration/spring-configuration.xml new file mode 100644 index 0000000..7341c77 --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/main/resources/spring-configuration/spring-configuration.xml @@ -0,0 +1,14 @@ + + + + diff --git a/cxf/web-services-spring-cxf-server/src/main/resources/spring-configuration/ws/soap-ws.xml b/cxf/web-services-spring-cxf-server/src/main/resources/spring-configuration/ws/soap-ws.xml new file mode 100644 index 0000000..afabf4e --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/main/resources/spring-configuration/ws/soap-ws.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + classpath:examples.xsd + classpath:parent.xsd + + + + + + + + + + + + + org.springframework.oxm.ValidationFailureException=CLIENT,Invalid request + + + + + diff --git a/cxf/web-services-spring-cxf-server/src/main/webapp/WEB-INF/web.xml b/cxf/web-services-spring-cxf-server/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..7e14eba --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,44 @@ + + + + Spring Web Services: example + + + + org.springframework.web.context.ContextLoaderListener + + + + + spring.profiles.active + ${environment.profile} + contextConfigLocation + + classpath*:spring-configuration/*.xml + + + + + + spring-ws + org.springframework.ws.transport.http.MessageDispatcherServlet + 1 + true + + contextConfigLocation + classpath*:spring-configuration/ws/*.xml + + + transformWsdlLocations + true + + + + + spring-ws + /spring-ws/* + + + diff --git a/cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointIntegrationTest.java b/cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointIntegrationTest.java new file mode 100644 index 0000000..f0204cb --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointIntegrationTest.java @@ -0,0 +1,62 @@ +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(locations = { "classpath*:spring-configuration/ws/soap-ws.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( + "" + + "SCARLETT" + + ""); + final Source responsePayload = new StringSource( + "" + + "SNAKE EYES AND SCARLETT" + + ""); + mockClient.sendRequest(withPayload(requestPayload)).andExpect( + payload(responsePayload)); + + + final Source customRequestPayload = new StringSource( + "" + + "SCARLETT" + + "2015-06-03T10:20:30Z" + + "FIRST" + + ""); + final Source customResponsePayload = new StringSource( + "" + + "CUSTOM BINDING SNAKE EYES AND SCARLETT" + + "FIRST" + + ""); + mockClient.sendRequest(withPayload(customRequestPayload)).andExpect( + payload(customResponsePayload)); + } +} + diff --git a/cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointTest.java b/cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointTest.java new file mode 100644 index 0000000..5b04c2f --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointTest.java @@ -0,0 +1,52 @@ +package de.spring.webservices.endpoints; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; + +import de.spring.webservices.auto.CustomBindingExampleRequest; +import de.spring.webservices.auto.CustomBindingExampleResponse; +import de.spring.webservices.auto.ExampleRequest; +import de.spring.webservices.operations.Operations; +import de.spring.webservices.services.ExampleService; + + +public class ExampleEndPointTest { + + private ExampleService exampleService; + + private Operations.RequestResponse + customBindingExampleService; + + private ExampleEndPoint exampleEndPoint; + + @Before + public void init() { + exampleService = mock(ExampleService.class); + customBindingExampleService = mock(Operations.RequestResponse.class); + exampleEndPoint = new ExampleEndPoint(customBindingExampleService, exampleService); + } + + @Test + public void givenExampleRequestThenInvokeExampleService() { + ExampleRequest request = new ExampleRequest(); + request.setData("SCARLETT"); + + exampleEndPoint.exampleResponse(request, null, null); + + verify(exampleService).doResponse(request); + } + + @Test + public void givenCustomBindingExampleRequestThenInvokeCustomBindingExampleService() { + CustomBindingExampleRequest request = new CustomBindingExampleRequest(); + request.setData("SCARLETT"); + + exampleEndPoint.cuntomBindingExampleResponse(request, null, null); + + verify(customBindingExampleService).requestResponse(request); + } + +} diff --git a/cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/services/CustomBindingExampleServiceTest.java b/cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/services/CustomBindingExampleServiceTest.java new file mode 100644 index 0000000..a6d493b --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/services/CustomBindingExampleServiceTest.java @@ -0,0 +1,34 @@ +package de.spring.webservices.services; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import de.spring.webservices.auto.CustomBindingExampleRequest; +import de.spring.webservices.auto.CustomBindingExampleResponse; +import de.spring.webservices.operations.Operations; +import de.spring.webservices.services.impl.CustomBindingExampleServiceImpl; + + +public class CustomBindingExampleServiceTest { + + private Operations.RequestResponse + customBindingExampleService; + + @Before + public void init() { + customBindingExampleService = new CustomBindingExampleServiceImpl(); + } + + @Test + public void givenCustomBindingExampleRequestThenReturnCustomBindingExampleResponse() { + CustomBindingExampleRequest request = new CustomBindingExampleRequest(); + request.setData("SCARLETT"); + CustomBindingExampleResponse expected = new CustomBindingExampleResponse(); + expected.setData("CUSTOM BINDING SNAKE EYES AND " + request.getData()); + + CustomBindingExampleResponse actual = customBindingExampleService.requestResponse(request); + + Assert.assertEquals(expected.getData(), actual.getData()); + } +} diff --git a/cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/services/ExampleServiceTest.java b/cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/services/ExampleServiceTest.java new file mode 100644 index 0000000..493c76d --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/test/java/de/spring/webservices/services/ExampleServiceTest.java @@ -0,0 +1,32 @@ +package de.spring.webservices.services; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import de.spring.webservices.auto.ExampleRequest; +import de.spring.webservices.auto.ExampleResponse; +import de.spring.webservices.services.impl.ExampleServiceImpl; + +public class ExampleServiceTest { + + private ExampleService exampleService; + + @Before + public void init() { + exampleService = new ExampleServiceImpl(); + } + + @Test + public void givenExampleRequestThenReturnExampleResponse() { + ExampleRequest request = new ExampleRequest(); + request.setData("SCARLETT"); + ExampleResponse expected = new ExampleResponse(); + expected.setData("SNAKE EYES AND " + request.getData()); + + ExampleResponse actual = exampleService.doResponse(request); + + Assert.assertEquals(expected.getData(), actual.getData()); + } + +} diff --git a/cxf/web-services-spring-cxf/pom.xml b/cxf/web-services-spring-cxf/pom.xml new file mode 100644 index 0000000..2769c08 --- /dev/null +++ b/cxf/web-services-spring-cxf/pom.xml @@ -0,0 +1,191 @@ + + 4.0.0 + de.spring.webservices + web-services-spring-cxf + pom + 1.0-SNAPSHOT + web-services-spring-cxf + http://gumartinm.name + Web Services Spring Framework + + Gustavo Martin Morcuende + http://www.gumartinm.name + + + scm:git:http://git.gumartinm.name/SpringWebServicesForFun + http://git.gumartinm.name/SpringWebServicesForFun + + + + UTF-8 + UTF-8 + + 4.0.9.RELEASE + 2.2.1.RELEASE + + + + + release + + release + + + true + + + + + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.3 + + + org.apache.logging.log4j + log4j-core + 2.3 + + + cglib + cglib + 2.2.2 + + + + + + org.springframework.ws + spring-ws-core + ${spring.ws.version} + + + org.springframework.ws + spring-xml + ${spring.ws.version} + + + org.jdom + jdom + 2.0.2 + + + + + wsdl4j + wsdl4j + 1.6.3 + + + + + junit + junit + 4.12 + test + + + org.springframework + spring-test + ${spring.version} + test + + + org.springframework.ws + spring-ws-test + ${spring.ws.version} + test + + + org.mockito + mockito-core + 2.0.11-beta + test + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.18.1 + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.18.1 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + 1.8 + 1.8 + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-resources-plugin + 2.7 + + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-jar-plugin + 2.4 + + + + ${project.description} + ${project.version} + ${project.organization.name} + ${project.description} + ${project.version} + ${project.organization.name} + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*IntegrationTest.java + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + integration-test + verify + + + + + + **/*IntegrationTest.java + + + + + + diff --git a/web-services-spring-client/pom.xml b/web-services-spring-client/pom.xml deleted file mode 100644 index 29e7648..0000000 --- a/web-services-spring-client/pom.xml +++ /dev/null @@ -1,184 +0,0 @@ - - 4.0.0 - - web-services-spring - de.spring.webservices - 1.0-SNAPSHOT - - web-services-spring-client - web-services-spring-client - http://gumartinm.name - - - src/main/build-resources/wsdl - ${basedir}/target/generated-sources/src/main/java - src/main/build-resources/bindings - - ${basedir}/src/main/build-resources/catalogs - - - - - org.springframework.ws - spring-ws-core - - - org.springframework.ws - spring-xml - - - org.jdom - jdom - - - - - - de.spring.webservices - web-services-spring-globalxsds - ${project.version} - - - - - - wsdl4j - wsdl4j - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - 0.9.4 - - - - - junit - junit - test - - - org.springframework - spring-test - test - - - org.springframework.ws - spring-ws-test - test - - - - - ${project.artifactId} - - - ${basedir}/src/main/resources/ - - **/*.* - - - - - - - org.apache.cxf - cxf-codegen-plugin - 3.1.0 - - - generate-sources-from-wsdl - generate-sources - - wsdl2java - - - true - ${project.wsdl.target.path} - - - - ${project.wsdl.sources.path}/example.wsdl - - ${project.bindings.path}/custombinding.xjb - - - -xjc-Xinheritance - -xjc-Xannotate - -catalog - ${project.catalogs.path}/catalog.cat - -verbose - - - - - - - - - - org.jvnet.jaxb2_commons - jaxb2-basics - 0.9.4 - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - 1.0.1 - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.9.1 - - - add-source - generate-sources - - add-source - - - - ${project.wsdl.target.path} - - - - - - - - - diff --git a/web-services-spring-client/src/main/build-resources/bindings/custombinding.xjb b/web-services-spring-client/src/main/build-resources/bindings/custombinding.xjb deleted file mode 100644 index 95e1fd2..0000000 --- a/web-services-spring-client/src/main/build-resources/bindings/custombinding.xjb +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - de.spring.webservices.operations.Request - @java.lang.suppresswarnings({"unchecked","rawtypes"}) - - - - de.spring.webservices.operations.Response - @java.lang.suppresswarnings({"unchecked","rawtypes"}) - - - - - - - - - diff --git a/web-services-spring-client/src/main/build-resources/catalogs/catalog.cat b/web-services-spring-client/src/main/build-resources/catalogs/catalog.cat deleted file mode 100644 index 4bc1c66..0000000 --- a/web-services-spring-client/src/main/build-resources/catalogs/catalog.cat +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/web-services-spring-client/src/main/build-resources/wsdl/example.wsdl b/web-services-spring-client/src/main/build-resources/wsdl/example.wsdl deleted file mode 100644 index 02b2256..0000000 --- a/web-services-spring-client/src/main/build-resources/wsdl/example.wsdl +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - - - - - - - @java.lang.SuppressWarnings({"unchecked","rawtypes"}) - de.spring.webservices.operations.Request - - - - - - - - - - - - de.spring.webservices.operations.Response - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 deleted file mode 100644 index 177c13e..0000000 --- a/web-services-spring-client/src/main/java/de/spring/webservices/client/ExampleClientService.java +++ /dev/null @@ -1,72 +0,0 @@ -package de.spring.webservices.client; - -import name.gumartinm.spring_ws.parent.ParentEnumType; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.ws.client.core.WebServiceTemplate; - -import de.spring.webservices.auto.CustomBindingExampleRequest; -import de.spring.webservices.auto.CustomBindingExampleResponse; -import de.spring.webservices.auto.ExampleRequest; -import de.spring.webservices.auto.ExampleResponse; -import de.spring.webservices.auto.Examples; -import de.spring.webservices.auto.ExamplesService; - -/** - * Someone could write code like this one in order to send and receive - * information from our Web Services. - * - */ -public class ExampleClientService { - 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."); - customBindingxampleRequest.setParentEnum(ParentEnumType.FIRST); - - 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 deleted file mode 100644 index 48fbdcd..0000000 --- a/web-services-spring-client/src/main/java/de/spring/webservices/client/MainTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package de.spring.webservices.client; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import de.spring.webservices.auto.CustomBindingExampleResponse; -import de.spring.webservices.auto.ExampleResponse; - -/** - * This class is used just like a nice example about how to write and run client - * code which will send data to and from the Web Services. - * - */ -public class MainTest { - private static final Logger logger = LoggerFactory.getLogger(MainTest.class); - - public ApplicationContext context; - - /** - * @param args - */ - public static void main(final String[] args) { - final MainTest test = new MainTest(); - - test.context = new ClassPathXmlApplicationContext( - "classpath:spring-configuration/ws/client-spring-configuration.xml"); - - final ExampleClientService example = - (ExampleClientService) test.context.getBean("exampleClient"); - - logger.info("ExampleResponse Java:"); - ExampleResponse response = example.sendAndReceiveJava(); - logger.info(response.getData()); - - - logger.info("CustomBindingExampleResponse Java:"); - CustomBindingExampleResponse customBindingResponse = example.sendAndReceiveJavaCustom(); - logger.info(customBindingResponse.getData()); - - - logger.info("ExampleResponse Spring:"); - response = example.sendAndReceiveSpring(); - logger.info(response.getData()); - - - logger.info("CustomBindingExampleResponse Spring:"); - customBindingResponse = example.sendAndReceiveSpringCustom(); - logger.info(customBindingResponse.getData()); - } -} diff --git a/web-services-spring-client/src/main/resources/examples.xsd b/web-services-spring-client/src/main/resources/examples.xsd deleted file mode 100644 index 96c3737..0000000 --- a/web-services-spring-client/src/main/resources/examples.xsd +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - @java.lang.SuppressWarnings({"unchecked","rawtypes"}) - de.spring.webservices.operations.Request - - - - - - - - - - - - de.spring.webservices.operations.Response - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/web-services-spring-client/src/main/resources/log4j2.xml b/web-services-spring-client/src/main/resources/log4j2.xml deleted file mode 100644 index 18a4008..0000000 --- a/web-services-spring-client/src/main/resources/log4j2.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - diff --git a/web-services-spring-client/src/main/resources/spring-configuration/ws/client-spring-configuration.xml b/web-services-spring-client/src/main/resources/spring-configuration/ws/client-spring-configuration.xml deleted file mode 100644 index 785d2db..0000000 --- a/web-services-spring-client/src/main/resources/spring-configuration/ws/client-spring-configuration.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - classpath:examples.xsd - classpath:parent.xsd - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 deleted file mode 100644 index a536c47..0000000 --- a/web-services-spring-client/src/test/java/de/spring/webservices/client/ExampleClientServiceIntegrationTest.java +++ /dev/null @@ -1,78 +0,0 @@ -package de.spring.webservices.client; - -import static org.junit.Assert.assertEquals; -import static org.springframework.ws.test.client.RequestMatchers.payload; -import static org.springframework.ws.test.client.ResponseCreators.withPayload; - -import 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.client.core.WebServiceTemplate; -import org.springframework.ws.test.client.MockWebServiceServer; -import org.springframework.xml.transform.StringSource; - -import de.spring.webservices.auto.CustomBindingExampleResponse; -import de.spring.webservices.auto.ExampleResponse; - - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath*:spring-configuration/ws/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( - "" - + "SCARLETT SPRING. IT IS CANON." - + ""); - final Source responsePayload = new StringSource( - "" - + "SNAKE EYES AND SCARLETT SPRING. IT IS CANON." - + ""); - mockServer.expect(payload(requestPayload)).andRespond( - withPayload(responsePayload)); - - final ExampleResponse response = exampleClientService.sendAndReceiveSpring(); - - assertEquals(response.getData(), "SNAKE EYES AND SCARLETT SPRING. IT IS CANON."); - mockServer.verify(); - } - - @Test - public void customerCustomClient() throws Exception { - final Source customRequestPayload = new StringSource( - "" + - "CUSTOM BINDING SPRING. SCARLETT. IT IS CANON." + - ""); - final Source customResponsePayload = new StringSource( - "" + - "CUSTOM BINDING SNAKE EYES AND SCARLETT SPRING. IT IS CANON." + - ""); - mockServer.expect(payload(customRequestPayload)).andRespond( - withPayload(customResponsePayload)); - - final CustomBindingExampleResponse response = exampleClientService.sendAndReceiveSpringCustom(); - - assertEquals(response.getData(), "CUSTOM BINDING SNAKE EYES AND SCARLETT SPRING. IT IS CANON."); - mockServer.verify(); - } -} - diff --git a/web-services-spring-globalxsds/pom.xml b/web-services-spring-globalxsds/pom.xml deleted file mode 100644 index 89451b9..0000000 --- a/web-services-spring-globalxsds/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ - - 4.0.0 - - web-services-spring - de.spring.webservices - 1.0-SNAPSHOT - - web-services-spring-globalxsds - web-services-spring-globalxsds - http://gumartinm.name - - - src/main/resources - ${basedir}/target/generated-sources/src/main/java - de.spring.webservices.auto - src/main/build-resources/bindings - - - - - - - junit - junit - test - - - - - ${project.artifactId} - - - ${basedir}/src/main/resources - - **/*.* - - - - - - - org.apache.cxf - cxf-xjc-plugin - 3.0.3 - - true - - org.apache.cxf.xjcplugins:cxf-xjc-dv:3.0.3 - - - - - generate-sources-from-xsd - generate-sources - - xsdtojava - - - ${project.xsd.schemas.target.path} - - - true - ${project.xsd.schemas.source.path}/parent.xsd - ${project.bindings.path}/custombinding.xjb - ${project.xsd.schemas.package.name} - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.9.1 - - - add-source - generate-sources - - add-source - - - - ${project.xsd.schemas.target.path} - - - - - - - - diff --git a/web-services-spring-globalxsds/src/main/build-resources/bindings/custombinding.xjb b/web-services-spring-globalxsds/src/main/build-resources/bindings/custombinding.xjb deleted file mode 100644 index 8b4a110..0000000 --- a/web-services-spring-globalxsds/src/main/build-resources/bindings/custombinding.xjb +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/web-services-spring-globalxsds/src/main/java/de/spring/webservices/binders/XSDateTimeCustomBinder.java b/web-services-spring-globalxsds/src/main/java/de/spring/webservices/binders/XSDateTimeCustomBinder.java deleted file mode 100644 index f39921a..0000000 --- a/web-services-spring-globalxsds/src/main/java/de/spring/webservices/binders/XSDateTimeCustomBinder.java +++ /dev/null @@ -1,35 +0,0 @@ -package de.spring.webservices.binders; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - - -/** - * ATTENTION: if you are using this custombinder you will have to create custom payload - * validators for Spring (AS FAR AS I KNOW) - * - */ -public class XSDateTimeCustomBinder extends XmlAdapter { - - @Override - public Date unmarshal(final String dateTime) throws Exception { - // X pattern just works from Java >= 1.7 - final DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX"); - formatter.setTimeZone(TimeZone.getTimeZone("Europe/Madrid")); - - return formatter.parse(dateTime); - } - - @Override - public String marshal(final Date dateTime) throws Exception { - // X pattern just works from Java >= 1.7 - final DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX"); - formatter.setTimeZone(TimeZone.getTimeZone("Europe/Madrid")); - - return formatter.format(dateTime); - } -} diff --git a/web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Operations.java b/web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Operations.java deleted file mode 100644 index 13b5113..0000000 --- a/web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Operations.java +++ /dev/null @@ -1,111 +0,0 @@ -package de.spring.webservices.operations; - -/** - *

- * Operations: WSDL v1.1 and v2.0 - *

- * See: http://www.w3.org/TR/wsdl#_porttypes
- * See: - * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns - * - */ -public interface Operations { - - /** - *

- * Request-response operation WSDL v1.1 - *

- * See: http://www.w3.org - * /TR/wsdl#_request-response - * - * @param - * Describes {@link Response} - * @param - * Describes {@link Request} - */ - public static interface RequestResponse { - T requestResponse(E request); - } - - /** - *

- * One-way operation WSDL v1.1 - *

- * See: http://www.w3.org/TR/wsdl - * #_one-way - * - * @param - * Describes {@link Response} - * @param - * Describes {@link Request} - */ - public interface OneWay { - void oneWay(E request); - } - - /** - *

- * Notification operation WSDL v1.1 - *

- * See: http://www.w3.org/TR - * /wsdl#_notification - * - * @param - * Describes {@link Response} - * @param - * Describes {@link Request} - */ - public interface Notification { - T notification(); - } - - /** - *

- * In-Only message exchange pattern WSDL 2.0 - *

- * See: - * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns - * - * @param - * Describes {@link Request} - */ - public interface InOnly { - void inOnly(E request); - } - - /** - *

- * Robust In-Only message exchange pattern WSDL 2.0 - *

- * See: - * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns - * - * @param - * Describes {@link Request} - */ - public interface RobustInOnly { - void robustInOnly(E request); - } - - /** - *

- * In-Out message exchange pattern WSDL 2.0 - *

- * See: - * http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/#patterns - * - * @param - * Describes {@link Response} - * @param - * Describes {@link Request} - */ - public interface InOut { - T inOut(E request); - } -} \ No newline at end of file diff --git a/web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Request.java b/web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Request.java deleted file mode 100644 index 77d81f4..0000000 --- a/web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Request.java +++ /dev/null @@ -1,5 +0,0 @@ -package de.spring.webservices.operations; - -public interface Request { - -} diff --git a/web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Response.java b/web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Response.java deleted file mode 100644 index 3a2cbea..0000000 --- a/web-services-spring-globalxsds/src/main/java/de/spring/webservices/operations/Response.java +++ /dev/null @@ -1,5 +0,0 @@ -package de.spring.webservices.operations; - -public interface Response { - -} diff --git a/web-services-spring-globalxsds/src/main/resources/parent.xsd b/web-services-spring-globalxsds/src/main/resources/parent.xsd deleted file mode 100644 index 0ce508e..0000000 --- a/web-services-spring-globalxsds/src/main/resources/parent.xsd +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - diff --git a/web-services-spring-server/pom.xml b/web-services-spring-server/pom.xml deleted file mode 100644 index f7ee949..0000000 --- a/web-services-spring-server/pom.xml +++ /dev/null @@ -1,221 +0,0 @@ - - 4.0.0 - - web-services-spring - de.spring.webservices - 1.0-SNAPSHOT - - web-services-spring-server - war - web-services-spring-server - http://gumartinm.name - - - 9.3.0.RC0 - src/main/resources - ${basedir}/target/generated-sources/src/main/java - de.spring.webservices.auto - src/main/build-resources/bindings - - ${basedir}/src/main/build-resources/catalogs - - - - - org.springframework.ws - spring-ws-core - - - org.springframework.ws - spring-xml - - - org.jdom - jdom - - - - - - de.spring.webservices - web-services-spring-globalxsds - ${project.version} - - - - - - wsdl4j - wsdl4j - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - 0.9.4 - - - - - junit - junit - test - - - org.springframework - spring-test - test - - - org.springframework.ws - spring-ws-test - test - - - org.mockito - mockito-core - test - - - - - ${project.artifactId} - - - ${basedir}/src/main/webapp - - **/*.* - - - - ${basedir}/src/main/resources/ - - **/*.* - - - - - - - org.apache.cxf - cxf-xjc-plugin - 3.0.3 - - true - - org.apache.cxf.xjcplugins:cxf-xjc-dv:3.0.3 - - - - - generate-sources-from-xsd - generate-sources - - xsdtojava - - - ${project.xsd.schemas.target.path} - - - true - ${project.xsd.schemas.source.path}/examples.xsd - ${project.bindings.path}/custombinding.xjb - ${project.catalogs.path}/catalog.cat - ${project.xsd.schemas.package.name} - - -Xinheritance - -Xannotate - - - - - - - - - - org.jvnet.jaxb2_commons - jaxb2-basics - 0.9.4 - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - 1.0.1 - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.9.1 - - - add-source - generate-sources - - add-source - - - - ${project.xsd.schemas.target.path} - - - - - - - org.apache.maven.plugins - maven-war-plugin - 2.6 - - - - true - src/main/webapp - - WEB-INF/web.xml - - - - - - - org.eclipse.jetty - jetty-maven-plugin - ${jetty.version} - - ${basedir}/src/main/jetty/jetty-http.xml - - - - - diff --git a/web-services-spring-server/src/main/build-resources/bindings/custombinding.xjb b/web-services-spring-server/src/main/build-resources/bindings/custombinding.xjb deleted file mode 100644 index a1430d5..0000000 --- a/web-services-spring-server/src/main/build-resources/bindings/custombinding.xjb +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - de.spring.webservices.operations.Request - @java.lang.SuppressWarnings({"unchecked","rawtypes"}) - - - - - - - de.spring.webservices.operations.Response - @java.lang.SuppressWarnings({"unchecked","rawtypes"}) - - - - - - - - - - - diff --git a/web-services-spring-server/src/main/build-resources/catalogs/catalog.cat b/web-services-spring-server/src/main/build-resources/catalogs/catalog.cat deleted file mode 100644 index 4bc1c66..0000000 --- a/web-services-spring-server/src/main/build-resources/catalogs/catalog.cat +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - 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 deleted file mode 100644 index 8fb4e40..0000000 --- a/web-services-spring-server/src/main/java/de/spring/webservices/endpoints/ExampleEndPoint.java +++ /dev/null @@ -1,57 +0,0 @@ -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; -import de.spring.webservices.services.ExampleService; - - -@Endpoint -public class ExampleEndPoint { - private static final String NAMESPACE_URI = "http://gumartinm.name/spring-ws/example"; - - private final Operations.RequestResponse - customBindingExampleService; - - private final ExampleService exampleService; - - @Autowired - public ExampleEndPoint( - RequestResponse customBindingExampleService, - ExampleService exampleService) { - this.customBindingExampleService = customBindingExampleService; - this.exampleService = exampleService; - } - - @PayloadRoot(localPart = "ExampleRequest", namespace = NAMESPACE_URI) - @ResponsePayload - public ExampleResponse exampleResponse( - @RequestPayload final ExampleRequest request, - @RequestPayload final Element element, - final MessageContext messageContext) { - - return this.exampleService.doResponse(request); - } - - @PayloadRoot(localPart = "CustomBindingExampleRequest", namespace = NAMESPACE_URI) - @ResponsePayload - public CustomBindingExampleResponse cuntomBindingExampleResponse( - @RequestPayload final CustomBindingExampleRequest requestObject, - @RequestPayload final Element element, - final MessageContext messageContext) { - - return this.customBindingExampleService.requestResponse(requestObject); - } -} - diff --git a/web-services-spring-server/src/main/java/de/spring/webservices/services/ExampleService.java b/web-services-spring-server/src/main/java/de/spring/webservices/services/ExampleService.java deleted file mode 100644 index 9d7eb79..0000000 --- a/web-services-spring-server/src/main/java/de/spring/webservices/services/ExampleService.java +++ /dev/null @@ -1,11 +0,0 @@ -package de.spring.webservices.services; - -import de.spring.webservices.auto.ExampleRequest; -import de.spring.webservices.auto.ExampleResponse; - - -public interface ExampleService { - - public ExampleResponse doResponse(ExampleRequest request); - -} diff --git a/web-services-spring-server/src/main/java/de/spring/webservices/services/impl/CustomBindingExampleServiceImpl.java b/web-services-spring-server/src/main/java/de/spring/webservices/services/impl/CustomBindingExampleServiceImpl.java deleted file mode 100644 index caa7e41..0000000 --- a/web-services-spring-server/src/main/java/de/spring/webservices/services/impl/CustomBindingExampleServiceImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -package de.spring.webservices.services.impl; - -import org.springframework.stereotype.Service; - -import de.spring.webservices.auto.CustomBindingExampleRequest; -import de.spring.webservices.auto.CustomBindingExampleResponse; -import de.spring.webservices.auto.ParentEnumType; -import de.spring.webservices.operations.Operations; - - -@Service("customBindingExampleService") -public class CustomBindingExampleServiceImpl implements - Operations.RequestResponse { - - - @Override - public CustomBindingExampleResponse requestResponse(final CustomBindingExampleRequest request) { - - CustomBindingExampleResponse response = new CustomBindingExampleResponse(); - - response.setData("CUSTOM BINDING SNAKE EYES AND " + request.getData()); - response.setParentEnum(ParentEnumType.FIRST); - - return response; - } - -} diff --git a/web-services-spring-server/src/main/java/de/spring/webservices/services/impl/ExampleServiceImpl.java b/web-services-spring-server/src/main/java/de/spring/webservices/services/impl/ExampleServiceImpl.java deleted file mode 100644 index 7037776..0000000 --- a/web-services-spring-server/src/main/java/de/spring/webservices/services/impl/ExampleServiceImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package de.spring.webservices.services.impl; - -import org.springframework.stereotype.Service; - -import de.spring.webservices.auto.ExampleRequest; -import de.spring.webservices.auto.ExampleResponse; -import de.spring.webservices.services.ExampleService; - - -@Service("exampleService") -public class ExampleServiceImpl implements ExampleService { - - @Override - public ExampleResponse doResponse(final ExampleRequest request) { - - ExampleResponse response = new ExampleResponse(); - - response.setData("SNAKE EYES AND " + request.getData()); - - return 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 deleted file mode 100644 index d995630..0000000 --- a/web-services-spring-server/src/main/jetty/jetty-http.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - https - - - - 32768 - 8192 - 8192 - true - false - 512 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/web-services-spring-server/src/main/resources/examples.xsd b/web-services-spring-server/src/main/resources/examples.xsd deleted file mode 100644 index 96c3737..0000000 --- a/web-services-spring-server/src/main/resources/examples.xsd +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - @java.lang.SuppressWarnings({"unchecked","rawtypes"}) - de.spring.webservices.operations.Request - - - - - - - - - - - - de.spring.webservices.operations.Response - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/web-services-spring-server/src/main/resources/log4j2.xml b/web-services-spring-server/src/main/resources/log4j2.xml deleted file mode 100644 index 18a4008..0000000 --- a/web-services-spring-server/src/main/resources/log4j2.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - 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 deleted file mode 100644 index 7341c77..0000000 --- a/web-services-spring-server/src/main/resources/spring-configuration/spring-configuration.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - 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 deleted file mode 100644 index afabf4e..0000000 --- a/web-services-spring-server/src/main/resources/spring-configuration/ws/soap-ws.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - classpath:examples.xsd - classpath:parent.xsd - - - - - - - - - - - - - org.springframework.oxm.ValidationFailureException=CLIENT,Invalid request - - - - - 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 deleted file mode 100644 index 7e14eba..0000000 --- a/web-services-spring-server/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - Spring Web Services: example - - - - org.springframework.web.context.ContextLoaderListener - - - - - spring.profiles.active - ${environment.profile} - contextConfigLocation - - classpath*:spring-configuration/*.xml - - - - - - spring-ws - org.springframework.ws.transport.http.MessageDispatcherServlet - 1 - true - - contextConfigLocation - classpath*:spring-configuration/ws/*.xml - - - transformWsdlLocations - true - - - - - spring-ws - /spring-ws/* - - - 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 deleted file mode 100644 index f0204cb..0000000 --- a/web-services-spring-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointIntegrationTest.java +++ /dev/null @@ -1,62 +0,0 @@ -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(locations = { "classpath*:spring-configuration/ws/soap-ws.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( - "" + - "SCARLETT" + - ""); - final Source responsePayload = new StringSource( - "" + - "SNAKE EYES AND SCARLETT" + - ""); - mockClient.sendRequest(withPayload(requestPayload)).andExpect( - payload(responsePayload)); - - - final Source customRequestPayload = new StringSource( - "" + - "SCARLETT" + - "2015-06-03T10:20:30Z" + - "FIRST" + - ""); - final Source customResponsePayload = new StringSource( - "" + - "CUSTOM BINDING SNAKE EYES AND SCARLETT" + - "FIRST" + - ""); - mockClient.sendRequest(withPayload(customRequestPayload)).andExpect( - payload(customResponsePayload)); - } -} - diff --git a/web-services-spring-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointTest.java b/web-services-spring-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointTest.java deleted file mode 100644 index 5b04c2f..0000000 --- a/web-services-spring-server/src/test/java/de/spring/webservices/endpoints/ExampleEndPointTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package de.spring.webservices.endpoints; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -import org.junit.Before; -import org.junit.Test; - -import de.spring.webservices.auto.CustomBindingExampleRequest; -import de.spring.webservices.auto.CustomBindingExampleResponse; -import de.spring.webservices.auto.ExampleRequest; -import de.spring.webservices.operations.Operations; -import de.spring.webservices.services.ExampleService; - - -public class ExampleEndPointTest { - - private ExampleService exampleService; - - private Operations.RequestResponse - customBindingExampleService; - - private ExampleEndPoint exampleEndPoint; - - @Before - public void init() { - exampleService = mock(ExampleService.class); - customBindingExampleService = mock(Operations.RequestResponse.class); - exampleEndPoint = new ExampleEndPoint(customBindingExampleService, exampleService); - } - - @Test - public void givenExampleRequestThenInvokeExampleService() { - ExampleRequest request = new ExampleRequest(); - request.setData("SCARLETT"); - - exampleEndPoint.exampleResponse(request, null, null); - - verify(exampleService).doResponse(request); - } - - @Test - public void givenCustomBindingExampleRequestThenInvokeCustomBindingExampleService() { - CustomBindingExampleRequest request = new CustomBindingExampleRequest(); - request.setData("SCARLETT"); - - exampleEndPoint.cuntomBindingExampleResponse(request, null, null); - - verify(customBindingExampleService).requestResponse(request); - } - -} diff --git a/web-services-spring-server/src/test/java/de/spring/webservices/services/CustomBindingExampleServiceTest.java b/web-services-spring-server/src/test/java/de/spring/webservices/services/CustomBindingExampleServiceTest.java deleted file mode 100644 index a6d493b..0000000 --- a/web-services-spring-server/src/test/java/de/spring/webservices/services/CustomBindingExampleServiceTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package de.spring.webservices.services; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import de.spring.webservices.auto.CustomBindingExampleRequest; -import de.spring.webservices.auto.CustomBindingExampleResponse; -import de.spring.webservices.operations.Operations; -import de.spring.webservices.services.impl.CustomBindingExampleServiceImpl; - - -public class CustomBindingExampleServiceTest { - - private Operations.RequestResponse - customBindingExampleService; - - @Before - public void init() { - customBindingExampleService = new CustomBindingExampleServiceImpl(); - } - - @Test - public void givenCustomBindingExampleRequestThenReturnCustomBindingExampleResponse() { - CustomBindingExampleRequest request = new CustomBindingExampleRequest(); - request.setData("SCARLETT"); - CustomBindingExampleResponse expected = new CustomBindingExampleResponse(); - expected.setData("CUSTOM BINDING SNAKE EYES AND " + request.getData()); - - CustomBindingExampleResponse actual = customBindingExampleService.requestResponse(request); - - Assert.assertEquals(expected.getData(), actual.getData()); - } -} diff --git a/web-services-spring-server/src/test/java/de/spring/webservices/services/ExampleServiceTest.java b/web-services-spring-server/src/test/java/de/spring/webservices/services/ExampleServiceTest.java deleted file mode 100644 index 493c76d..0000000 --- a/web-services-spring-server/src/test/java/de/spring/webservices/services/ExampleServiceTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package de.spring.webservices.services; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import de.spring.webservices.auto.ExampleRequest; -import de.spring.webservices.auto.ExampleResponse; -import de.spring.webservices.services.impl.ExampleServiceImpl; - -public class ExampleServiceTest { - - private ExampleService exampleService; - - @Before - public void init() { - exampleService = new ExampleServiceImpl(); - } - - @Test - public void givenExampleRequestThenReturnExampleResponse() { - ExampleRequest request = new ExampleRequest(); - request.setData("SCARLETT"); - ExampleResponse expected = new ExampleResponse(); - expected.setData("SNAKE EYES AND " + request.getData()); - - ExampleResponse actual = exampleService.doResponse(request); - - Assert.assertEquals(expected.getData(), actual.getData()); - } - -} diff --git a/web-services-spring/pom.xml b/web-services-spring/pom.xml deleted file mode 100644 index b328743..0000000 --- a/web-services-spring/pom.xml +++ /dev/null @@ -1,191 +0,0 @@ - - 4.0.0 - de.spring.webservices - web-services-spring - pom - 1.0-SNAPSHOT - web-services-spring - http://gumartinm.name - Web Services Spring Framework - - Gustavo Martin Morcuende - http://www.gumartinm.name - - - scm:git:http://git.gumartinm.name/SpringWebServicesForFun - http://git.gumartinm.name/SpringWebServicesForFun - - - - UTF-8 - UTF-8 - - 4.0.9.RELEASE - 2.2.1.RELEASE - - - - - release - - release - - - true - - - - - - - org.apache.logging.log4j - log4j-slf4j-impl - 2.3 - - - org.apache.logging.log4j - log4j-core - 2.3 - - - cglib - cglib - 2.2.2 - - - - - - org.springframework.ws - spring-ws-core - ${spring.ws.version} - - - org.springframework.ws - spring-xml - ${spring.ws.version} - - - org.jdom - jdom - 2.0.2 - - - - - wsdl4j - wsdl4j - 1.6.3 - - - - - junit - junit - 4.12 - test - - - org.springframework - spring-test - ${spring.version} - test - - - org.springframework.ws - spring-ws-test - ${spring.ws.version} - test - - - org.mockito - mockito-core - 2.0.11-beta - test - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.18.1 - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.18.1 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.3 - - 1.8 - 1.8 - ${project.build.sourceEncoding} - - - - org.apache.maven.plugins - maven-resources-plugin - 2.7 - - ${project.build.sourceEncoding} - - - - org.apache.maven.plugins - maven-jar-plugin - 2.4 - - - - ${project.description} - ${project.version} - ${project.organization.name} - ${project.description} - ${project.version} - ${project.organization.name} - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/*IntegrationTest.java - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - integration-test - verify - - - - - - **/*IntegrationTest.java - - - - - - -- 2.1.4