8fb4e40a58dab19e8718427e9dea570907827abe
[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.auto.CustomBindingExampleRequest;
12 import de.spring.webservices.auto.CustomBindingExampleResponse;
13 import de.spring.webservices.auto.ExampleRequest;
14 import de.spring.webservices.auto.ExampleResponse;
15 import de.spring.webservices.operations.Operations;
16 import de.spring.webservices.operations.Operations.RequestResponse;
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