1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.ws.server.endpoint.adapter;
18
19 import javax.xml.transform.Source;
20
21 import org.springframework.ws.WebServiceMessage;
22 import org.springframework.ws.context.MessageContext;
23 import org.springframework.ws.server.EndpointAdapter;
24 import org.springframework.ws.server.MessageDispatcher;
25 import org.springframework.ws.server.endpoint.PayloadEndpoint;
26 import org.springframework.ws.soap.server.SoapMessageDispatcher;
27 import org.springframework.xml.transform.TransformerObjectSupport;
28
29
30
31
32
33
34
35
36
37
38
39 public class PayloadEndpointAdapter extends TransformerObjectSupport implements EndpointAdapter {
40
41 public boolean supports(Object endpoint) {
42 return endpoint instanceof PayloadEndpoint;
43 }
44
45 public void invoke(MessageContext messageContext, Object endpoint) throws Exception {
46 PayloadEndpoint payloadEndpoint = (PayloadEndpoint) endpoint;
47 Source requestSource = messageContext.getRequest().getPayloadSource();
48 Source responseSource = payloadEndpoint.invoke(requestSource);
49 if (responseSource != null) {
50 WebServiceMessage response = messageContext.getResponse();
51 transform(responseSource, response.getPayloadResult());
52 }
53 }
54 }