1 package de.spring.webservices.endpoints;
3 import org.jdom2.Element;
4 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.ws.context.MessageContext;
6 import org.springframework.ws.server.endpoint.annotation.Endpoint;
7 import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
8 import org.springframework.ws.server.endpoint.annotation.RequestPayload;
9 import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
11 import de.spring.webservices.operations.Operations;
12 import de.spring.webservices.operations.Operations.RequestResponse;
13 import de.spring.webservices.server.auto.CustomBindingExampleRequest;
14 import de.spring.webservices.server.auto.CustomBindingExampleResponse;
15 import de.spring.webservices.server.auto.ExampleRequest;
16 import de.spring.webservices.server.auto.ExampleResponse;
17 import de.spring.webservices.services.ExampleService;
21 public class ExampleEndPoint {
22 private static final String NAMESPACE_URI = "http://gumartinm.name/spring-ws/example";
24 private final Operations.RequestResponse
25 <CustomBindingExampleResponse, CustomBindingExampleRequest> customBindingExampleService;
27 private final ExampleService exampleService;
30 public ExampleEndPoint(
31 RequestResponse<CustomBindingExampleResponse, CustomBindingExampleRequest> customBindingExampleService,
32 ExampleService exampleService) {
33 this.customBindingExampleService = customBindingExampleService;
34 this.exampleService = exampleService;
37 // WARNING!!! RESPONSE OBJECT MUST BE ANNOTATED WITH @XmlRootElement
38 // (ExampleResponse has such annotation)
39 // OTHERWISE YOU WILL SEE THIS WEIRD ERROR: "No adapter for endPoint"
40 // see: http://stackoverflow.com/a/22227806
41 @PayloadRoot(localPart = "ExampleRequest", namespace = NAMESPACE_URI)
43 public ExampleResponse exampleResponse(
44 @RequestPayload final ExampleRequest request,
45 @RequestPayload final Element element,
46 final MessageContext messageContext) {
48 return this.exampleService.doResponse(request);
51 // WARNING!!! RESPONSE OBJECT MUST BE ANNOTATED WITH @XmlRootElement
52 // (ExampleResponse has such annotation)
53 // OTHERWISE YOU WILL SEE THIS WEIRD ERROR: "No adapter for endPoint"
54 // see: http://stackoverflow.com/a/22227806
55 @PayloadRoot(localPart = "CustomBindingExampleRequest", namespace = NAMESPACE_URI)
57 public CustomBindingExampleResponse cuntomBindingExampleResponse(
58 @RequestPayload final CustomBindingExampleRequest requestObject,
59 @RequestPayload final Element element,
60 final MessageContext messageContext) {
62 return this.customBindingExampleService.requestResponse(requestObject);