e3e8da68b6a6b75d830d30c5bea4bff94d1ddd58
[SpringWebServicesForFun/.git] /
1 package de.spring.webservices.endpoints;
2
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;
10
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;
18
19
20 @Endpoint
21 public class ExampleEndPoint {
22     private static final String NAMESPACE_URI = "http://gumartinm.name/spring-ws/example";
23     
24     private final Operations.RequestResponse
25         <CustomBindingExampleResponse, CustomBindingExampleRequest> customBindingExampleService;  
26     
27     private final ExampleService exampleService;
28     
29     @Autowired
30         public ExampleEndPoint(
31             RequestResponse<CustomBindingExampleResponse, CustomBindingExampleRequest> customBindingExampleService,
32             ExampleService exampleService) {
33             this.customBindingExampleService = customBindingExampleService;
34             this.exampleService = exampleService;
35     }
36         
37     @PayloadRoot(localPart = "ExampleRequest", namespace = NAMESPACE_URI)
38     @ResponsePayload
39     public ExampleResponse exampleResponse(
40             @RequestPayload final ExampleRequest request,
41             @RequestPayload final Element element,
42             final MessageContext messageContext) {
43
44         return this.exampleService.doResponse(request);
45     }
46     
47     @PayloadRoot(localPart = "CustomBindingExampleRequest", namespace = NAMESPACE_URI)
48     @ResponsePayload
49     public CustomBindingExampleResponse cuntomBindingExampleResponse(
50             @RequestPayload final CustomBindingExampleRequest requestObject,
51             @RequestPayload final Element element,
52             final MessageContext messageContext) {
53
54         return this.customBindingExampleService.requestResponse(requestObject);
55     }
56 }
57