From 7200ec335e1001c2704256607c70beea4e3bd9b3 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Sun, 20 Dec 2015 02:47:00 +0100 Subject: [PATCH] cxf: improvements --- .../webservices/client/ExampleClientService.java | 8 ++- .../de/spring/webservices/client/MainTest.java | 8 ++- .../ws/client-spring-configuration.xml | 65 ++++++++++++++++------ 3 files changed, 61 insertions(+), 20 deletions(-) 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 index 177c13e..578bcca 100644 --- 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 @@ -3,10 +3,13 @@ package de.spring.webservices.client; import name.gumartinm.spring_ws.parent.ParentEnumType; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; import org.springframework.ws.client.core.WebServiceTemplate; +import de.spring.webservices.auto.CustomBindingExampleFault_Exception; import de.spring.webservices.auto.CustomBindingExampleRequest; import de.spring.webservices.auto.CustomBindingExampleResponse; +import de.spring.webservices.auto.ExampleFault_Exception; import de.spring.webservices.auto.ExampleRequest; import de.spring.webservices.auto.ExampleResponse; import de.spring.webservices.auto.Examples; @@ -17,6 +20,7 @@ import de.spring.webservices.auto.ExamplesService; * information from our Web Services. * */ +@Service("exampleClientService") public class ExampleClientService { private final WebServiceTemplate webServiceTemplate; @@ -25,7 +29,7 @@ public class ExampleClientService { this.webServiceTemplate = webServiceTemplate; } - public ExampleResponse sendAndReceiveJava() { + public ExampleResponse sendAndReceiveJava() throws ExampleFault_Exception { final ExampleRequest exampleRequest = new ExampleRequest(); exampleRequest.setData("SCARLETT JAVA. IT IS CANON."); @@ -45,7 +49,7 @@ public class ExampleClientService { return exampleResponse; } - public CustomBindingExampleResponse sendAndReceiveJavaCustom() { + public CustomBindingExampleResponse sendAndReceiveJavaCustom() throws CustomBindingExampleFault_Exception { final CustomBindingExampleRequest customBindingxampleRequest = new CustomBindingExampleRequest(); customBindingxampleRequest.setData("CUSTOM BINDING JAVA. SCARLETT. IT IS CANON."); 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 index 48fbdcd..c5d8e6f 100644 --- 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 @@ -5,7 +5,9 @@ import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; +import de.spring.webservices.auto.CustomBindingExampleFault_Exception; import de.spring.webservices.auto.CustomBindingExampleResponse; +import de.spring.webservices.auto.ExampleFault_Exception; import de.spring.webservices.auto.ExampleResponse; /** @@ -20,15 +22,17 @@ public class MainTest { /** * @param args + * @throws ExampleFault_Exception + * @throws CustomBindingExampleFault_Exception */ - public static void main(final String[] args) { + public static void main(final String[] args) throws ExampleFault_Exception, CustomBindingExampleFault_Exception { 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"); + (ExampleClientService) test.context.getBean("exampleClientService"); logger.info("ExampleResponse Java:"); ExampleResponse response = example.sendAndReceiveJava(); 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 index 785d2db..f231006 100644 --- 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 @@ -23,13 +23,50 @@ receive data from the Web Services. --> - + - - - - + + + + @@ -86,11 +116,14 @@ - - + --> -- 2.1.4