|
20 | 20 | import javax.xml.transform.Result;
|
21 | 21 | import javax.xml.transform.Source;
|
22 | 22 |
|
23 |
| -import org.springframework.ws.WebServiceMessage; |
24 |
| - |
25 | 23 | /**
|
26 | 24 | * Specifies a basic set of Web service operations. Implemented by {@link WebServiceTemplate}. Not often used directly,
|
27 | 25 | * but a useful option to enhance testability, as it can easily be mocked or stubbed.
|
|
32 | 30 | public interface WebServiceOperations {
|
33 | 31 |
|
34 | 32 | /**
|
35 |
| - * Sends a web service message that contains the given payload. Returns the payload of the response message, if |
36 |
| - * any. |
| 33 | + * Sends a web service message that contains the given payload, marshalled by the configured |
| 34 | + * <code>Marshaller</code>. Returns the unmarshalled payload of the response message, if any. |
37 | 35 | *
|
38 |
| - * @param requestPayload the payload of the request message |
39 |
| - * @return the payload of the response message, or <code>null</code> if no response is given |
| 36 | + * @param requestPayload the object to marshal into the request message payload |
| 37 | + * @return the unmarshalled payload of the response message, or <code>null</code> if no response is given |
| 38 | + * @throws IOException in case of I/O errors |
| 39 | + * @see WebServiceTemplate#setMarshaller(org.springframework.oxm.Marshaller) |
| 40 | + * @see WebServiceTemplate#setUnmarshaller(org.springframework.oxm.Unmarshaller) |
40 | 41 | */
|
41 |
| - Source sendAndReceive(Source requestPayload) throws IOException; |
| 42 | + Object marshalSendAndReceive(Object requestPayload) throws IOException; |
42 | 43 |
|
43 | 44 | /**
|
44 |
| - * Sends a web service message that contains the given payload. Returns the payload of the response message, if any. |
45 |
| - * The given callback allows changing of the request message after the payload has been written to it. |
| 45 | + * Sends a web service message that contains the given payload, marshalled by the configured |
| 46 | + * <code>Marshaller</code>. Returns the unmarshalled payload of the response message, if any. The given callback |
| 47 | + * allows changing of the request message after the payload has been marshalled to it. |
46 | 48 | *
|
47 |
| - * @param requestPayload the payload of the request message |
| 49 | + * @param requestPayload the object to marshal into the request message payload |
48 | 50 | * @param requestCallback callback to change message, can be <code>null</code>
|
49 |
| - * @return the payload of the response message, or <code>null</code> if no response is given |
| 51 | + * @return the unmarshalled payload of the response message, or <code>null</code> if no response is given |
| 52 | + * @throws IOException in case of I/O errors |
| 53 | + * @see WebServiceTemplate#setMarshaller(org.springframework.oxm.Marshaller) |
| 54 | + * @see WebServiceTemplate#setUnmarshaller(org.springframework.oxm.Unmarshaller) |
| 55 | + */ |
| 56 | + Object marshalSendAndReceive(Object requestPayload, WebServiceMessageCallback requestCallback) throws IOException; |
| 57 | + |
| 58 | + /** |
| 59 | + * Sends a web service message that contains the given payload, reading the result with a |
| 60 | + * <code>SourceExtractor</code>. |
| 61 | + * |
| 62 | + * @param requestPayload the payload of the request message |
| 63 | + * @param responseExtractor object that will extract results |
| 64 | + * @return an arbitrary result object, as returned by the <code>SourceExtractor</code> |
| 65 | + */ |
| 66 | + Object sendAndReceive(Source requestPayload, SourceExtractor responseExtractor) throws IOException; |
| 67 | + |
| 68 | + /** |
| 69 | + * Sends a web service message that contains the given payload, reading the result with a |
| 70 | + * <code>SourceExtractor</code>. |
| 71 | + * <p/> |
| 72 | + * The given callback allows changing of the request message after the payload has been written to it. |
| 73 | + * |
| 74 | + * @param requestPayload the payload of the request message |
| 75 | + * @param requestCallback callback to change message, can be <code>null</code> |
| 76 | + * @param responseExtractor object that will extract results |
| 77 | + * @return an arbitrary result object, as returned by the <code>SourceExtractor</code> |
50 | 78 | */
|
51 |
| - Source sendAndReceive(Source requestPayload, WebServiceMessageCallback requestCallback) throws IOException; |
| 79 | + Object sendAndReceive(Source requestPayload, |
| 80 | + WebServiceMessageCallback requestCallback, |
| 81 | + SourceExtractor responseExtractor) throws IOException; |
52 | 82 |
|
53 | 83 | /**
|
54 | 84 | * Sends a web service message that contains the given payload. Writes the response, if any, to the given
|
55 | 85 | * <code>Result</code>.
|
56 | 86 | *
|
57 | 87 | * @param requestPayload the payload of the request message
|
58 | 88 | * @param responseResult the result to write the response payload to
|
59 |
| - * @return <code>true</code> if a response was received; <code>false</code> otherwise |
| 89 | + * @throws IOException in case of I/O errors |
60 | 90 | */
|
61 |
| - boolean sendAndReceive(Source requestPayload, Result responseResult) throws IOException; |
| 91 | + void sendAndReceive(Source requestPayload, Result responseResult) throws IOException; |
62 | 92 |
|
63 | 93 | /**
|
64 | 94 | * Sends a web service message that contains the given payload. Writes the response, if any, to the given
|
65 |
| - * <code>Result</code>. The given callback allows changing of the request message after the payload has been written |
66 |
| - * to it. |
| 95 | + * <code>Result</code>. |
| 96 | + * <p/> |
| 97 | + * The given callback allows changing of the request message after the payload has been written to it. |
67 | 98 | *
|
68 | 99 | * @param requestPayload the payload of the request message
|
69 | 100 | * @param requestCallback callback to change message, can be <code>null</code>
|
70 | 101 | * @param responseResult the result to write the response payload to
|
71 |
| - * @return <code>true</code> if a response was received; <code>false</code> otherwise |
| 102 | + * @throws IOException in case of I/O errors |
72 | 103 | */
|
73 |
| - boolean sendAndReceive(Source requestPayload, WebServiceMessageCallback requestCallback, Result responseResult) |
| 104 | + void sendAndReceive(Source requestPayload, WebServiceMessageCallback requestCallback, Result responseResult) |
74 | 105 | throws IOException;
|
75 | 106 |
|
76 | 107 | /**
|
77 |
| - * Sends a web service message that contains the given payload, marshalled by the configured |
78 |
| - * <code>Marshaller</code>. Returns the unmarshalled payload of the response message, if any. |
79 |
| - * |
80 |
| - * @param requestPayload the object to marshal into the request message payload |
81 |
| - * @return the unmarshalled payload of the response message, or <code>null</code> if no response is given |
82 |
| - * @see org.springframework.ws.client.core.WebServiceTemplate#setMarshaller(org.springframework.oxm.Marshaller) |
83 |
| - * @see org.springframework.ws.client.core.WebServiceTemplate#setUnmarshaller(org.springframework.oxm.Unmarshaller) |
84 |
| - */ |
85 |
| - Object marshalSendAndReceive(Object requestPayload) throws IOException; |
86 |
| - |
87 |
| - /** |
88 |
| - * Sends a web service message that contains the given payload, marshalled by the configured |
89 |
| - * <code>Marshaller</code>. Returns the unmarshalled payload of the response message, if any. The given callback |
90 |
| - * allows changing of the request message after the payload has been marshalled to it. |
| 108 | + * Sends a web service message that can be manipulated with the given callback, reading the result with a |
| 109 | + * <code>WebServiceMessageExtractor</code>. |
91 | 110 | *
|
92 |
| - * @param requestPayload the object to marshal into the request message payload |
93 |
| - * @param requestCallback callback to change message, can be <code>null</code> |
94 |
| - * @return the unmarshalled payload of the response message, or <code>null</code> if no response is given |
95 |
| - * @see org.springframework.ws.client.core.WebServiceTemplate#setMarshaller(org.springframework.oxm.Marshaller) |
96 |
| - * @see org.springframework.ws.client.core.WebServiceTemplate#setUnmarshaller(org.springframework.oxm.Unmarshaller) |
| 111 | + * @param requestCallback the requestCallback to be used for manipulating the request message |
| 112 | + * @param responseExtractor object that will extract results |
| 113 | + * @return an arbitrary result object, as returned by the <code>WebServiceMessageExtractor</code> |
| 114 | + * @throws IOException in case of I/O errors |
97 | 115 | */
|
98 |
| - Object marshalSendAndReceive(Object requestPayload, WebServiceMessageCallback requestCallback) throws IOException; |
| 116 | + Object sendAndReceive(WebServiceMessageCallback requestCallback, WebServiceMessageExtractor responseExtractor) |
| 117 | + throws IOException; |
99 | 118 |
|
100 | 119 | /**
|
101 |
| - * Sends a web service message that can be manipulated with the given callback. Returns the response message, if |
102 |
| - * any. |
| 120 | + * Sends a web service message that can be manipulated with the given callback, reading the result with a |
| 121 | + * <code>WebServiceMessageExtractor</code>. |
103 | 122 | *
|
104 |
| - * @param requestCallback the requestCallback to be used for manipulating the request message |
105 |
| - * @return the response message, or <code>null</code> if no response is given |
| 123 | + * @param requestCallback the callback to be used for manipulating the request message |
| 124 | + * @param responseCallback the callback to be used for manipulating the response message |
| 125 | + * @throws IOException in case of I/O errors |
106 | 126 | */
|
107 |
| - WebServiceMessage sendAndReceive(WebServiceMessageCallback requestCallback) throws IOException; |
| 127 | + void sendAndReceive(WebServiceMessageCallback requestCallback, WebServiceMessageCallback responseCallback) |
| 128 | + throws IOException; |
108 | 129 | }
|
0 commit comments