From 877f41fc0ca11793aae2a2a72165f63a35df57d4 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Sat, 19 Dec 2015 22:53:58 +0100 Subject: [PATCH] cxf: many improvements about how Spring WS works --- .../src/main/resources/parent.xsd | 6 + .../webservices/exceptions/BusinessException.java | 22 +++ .../impl/CustomBindingExampleServiceImpl.java | 6 + .../src/main/resources/examples.xsd | 13 +- .../resources/spring-configuration/ws/soap-ws.xml | 150 ++++++++++++++++++--- 5 files changed, 181 insertions(+), 16 deletions(-) create mode 100644 cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/exceptions/BusinessException.java 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 index 0ce508e..3c340a4 100644 --- a/cxf/web-services-spring-cxf-globalxsds/src/main/resources/parent.xsd +++ b/cxf/web-services-spring-cxf-globalxsds/src/main/resources/parent.xsd @@ -12,5 +12,11 @@ + + + + + + diff --git a/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/exceptions/BusinessException.java b/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/exceptions/BusinessException.java new file mode 100644 index 0000000..f13ae91 --- /dev/null +++ b/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/exceptions/BusinessException.java @@ -0,0 +1,22 @@ +package de.spring.webservices.exceptions; + +/** + * This exception will be caught by org.springframework.ws.soap.server.endpoint.SoapFaultMappingExceptionResolver + * + */ +public class BusinessException extends RuntimeException { + + private static final long serialVersionUID = -4042139454770293299L; + + public BusinessException() { + super(); + } + + public BusinessException(String message) { + super(message); + } + + public BusinessException(String message, Throwable cause) { + super(message, cause); + } +} 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 index caa7e41..de65baa 100644 --- 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 @@ -2,6 +2,7 @@ package de.spring.webservices.services.impl; import org.springframework.stereotype.Service; +//import de.spring.webservices.exceptions.BusinessException; import de.spring.webservices.auto.CustomBindingExampleRequest; import de.spring.webservices.auto.CustomBindingExampleResponse; import de.spring.webservices.auto.ParentEnumType; @@ -16,6 +17,11 @@ public class CustomBindingExampleServiceImpl implements @Override public CustomBindingExampleResponse requestResponse(final CustomBindingExampleRequest request) { + + // Example about how works org.springframework.ws.soap.server.endpoint.SoapFaultMappingExceptionResolver + // see soap-ws.xml Spring configuration file. +// throw new BusinessException("This feature has not been implemented yet."); + CustomBindingExampleResponse response = new CustomBindingExampleResponse(); response.setData("CUSTOM BINDING SNAKE EYES AND " + request.getData()); 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 index 96c3737..8b4bb95 100644 --- a/cxf/web-services-spring-cxf-server/src/main/resources/examples.xsd +++ b/cxf/web-services-spring-cxf-server/src/main/resources/examples.xsd @@ -12,10 +12,21 @@ + @@ -26,7 +37,7 @@ - + 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 index 083605c..cd60455 100644 --- 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 @@ -14,28 +14,86 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> - + + + + + + + + + - + + + + - - org.springframework.oxm.ValidationFailureException=CLIENT,Invalid request - + + + SERVER + + + -- 2.1.4