diff --git a/core/src/main/java/org/springframework/ws/client/core/WebServiceOperations.java b/core/src/main/java/org/springframework/ws/client/core/WebServiceOperations.java
index 74ba9ecd..e76d842c 100644
--- a/core/src/main/java/org/springframework/ws/client/core/WebServiceOperations.java
+++ b/core/src/main/java/org/springframework/ws/client/core/WebServiceOperations.java
@@ -31,6 +31,66 @@ import org.springframework.ws.client.WebServiceClientException;
*/
public interface WebServiceOperations {
+ /**
+ * Sends a web service message that can be manipulated with the given callback, reading the result with a
+ * WebServiceMessageExtractor.
+ *
WebServiceMessageExtractor
+ * @throws WebServiceClientException if there is a problem sending or receiving the message
+ */
+ Object sendAndReceive(WebServiceMessageCallback requestCallback, WebServiceMessageExtractor responseExtractor)
+ throws WebServiceClientException;
+
+ /**
+ * Sends a web service message that can be manipulated with the given callback, reading the result with a
+ * WebServiceMessageExtractor.
+ *
+ * @param uri the URI to send the message to
+ * @param requestCallback the requestCallback to be used for manipulating the request message
+ * @param responseExtractor object that will extract results
+ * @return an arbitrary result object, as returned by the WebServiceMessageExtractor
+ * @throws WebServiceClientException if there is a problem sending or receiving the message
+ */
+ Object sendAndReceive(String uri,
+ WebServiceMessageCallback requestCallback,
+ WebServiceMessageExtractor responseExtractor) throws WebServiceClientException;
+
+ /**
+ * Sends a web service message that can be manipulated with the given request callback, handling the response with a
+ * response callback.
+ *
+ * This will only work with a default uri specified!
+ *
+ * @param requestCallback the callback to be used for manipulating the request message
+ * @param responseCallback the callback to be used for manipulating the response message
+ * @return true if a response was received; false otherwise
+ * @throws WebServiceClientException if there is a problem sending or receiving the message
+ */
+ boolean sendAndReceive(WebServiceMessageCallback requestCallback, WebServiceMessageCallback responseCallback)
+ throws WebServiceClientException;
+
+ /**
+ * Sends a web service message that can be manipulated with the given request callback, handling the response with a
+ * response callback.
+ *
+ * @param uri the URI to send the message to
+ * @param requestCallback the callback to be used for manipulating the request message
+ * @param responseCallback the callback to be used for manipulating the response message
+ * @return true if a response was received; false otherwise
+ * @throws WebServiceClientException if there is a problem sending or receiving the message
+ */
+ boolean sendAndReceive(String uri,
+ WebServiceMessageCallback requestCallback,
+ WebServiceMessageCallback responseCallback) throws WebServiceClientException;
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Convenience methods for sending and receiving marshalled messages
+ //-----------------------------------------------------------------------------------------------------------------
+
/**
* Sends a web service message that contains the given payload, marshalled by the configured
* Marshaller. Returns the unmarshalled payload of the response message, if any.
@@ -96,6 +156,10 @@ public interface WebServiceOperations {
Object marshalSendAndReceive(String uri, Object requestPayload, WebServiceMessageCallback requestCallback)
throws XmlMappingException, WebServiceClientException;
+ //-----------------------------------------------------------------------------------------------------------------
+ // Convenience methods for sending Sources
+ //-----------------------------------------------------------------------------------------------------------------
+
/**
* Sends a web service message that contains the given payload, reading the result with a
* SourceExtractor.
@@ -107,7 +171,8 @@ public interface WebServiceOperations {
* @return an arbitrary result object, as returned by the SourceExtractor
* @throws WebServiceClientException if there is a problem sending or receiving the message
*/
- Object sendAndReceive(Source requestPayload, SourceExtractor responseExtractor) throws WebServiceClientException;
+ Object sendSourceAndReceive(Source requestPayload, SourceExtractor responseExtractor)
+ throws WebServiceClientException;
/**
* Sends a web service message that contains the given payload, reading the result with a
@@ -119,7 +184,7 @@ public interface WebServiceOperations {
* @return an arbitrary result object, as returned by the SourceExtractor
* @throws WebServiceClientException if there is a problem sending or receiving the message
*/
- Object sendAndReceive(String uri, Source requestPayload, SourceExtractor responseExtractor)
+ Object sendSourceAndReceive(String uri, Source requestPayload, SourceExtractor responseExtractor)
throws WebServiceClientException;
/**
@@ -136,9 +201,9 @@ public interface WebServiceOperations {
* @return an arbitrary result object, as returned by the SourceExtractor
* @throws WebServiceClientException if there is a problem sending or receiving the message
*/
- Object sendAndReceive(Source requestPayload,
- WebServiceMessageCallback requestCallback,
- SourceExtractor responseExtractor) throws WebServiceClientException;
+ Object sendSourceAndReceive(Source requestPayload,
+ WebServiceMessageCallback requestCallback,
+ SourceExtractor responseExtractor) throws WebServiceClientException;
/**
* Sends a web service message that contains the given payload, reading the result with a
@@ -153,10 +218,14 @@ public interface WebServiceOperations {
* @return an arbitrary result object, as returned by the SourceExtractor
* @throws WebServiceClientException if there is a problem sending or receiving the message
*/
- Object sendAndReceive(String uri,
- Source requestPayload,
- WebServiceMessageCallback requestCallback,
- SourceExtractor responseExtractor) throws WebServiceClientException;
+ Object sendSourceAndReceive(String uri,
+ Source requestPayload,
+ WebServiceMessageCallback requestCallback,
+ SourceExtractor responseExtractor) throws WebServiceClientException;
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Convenience methods for sending Sources and receiving to Results
+ //-----------------------------------------------------------------------------------------------------------------
/**
* Sends a web service message that contains the given payload. Writes the response, if any, to the given
@@ -169,7 +238,7 @@ public interface WebServiceOperations {
* @return true if a response was received; false otherwise
* @throws WebServiceClientException if there is a problem sending or receiving the message
*/
- boolean sendAndReceive(Source requestPayload, Result responseResult) throws WebServiceClientException;
+ boolean sendSourceAndReceiveToResult(Source requestPayload, Result responseResult) throws WebServiceClientException;
/**
* Sends a web service message that contains the given payload. Writes the response, if any, to the given
@@ -181,7 +250,8 @@ public interface WebServiceOperations {
* @return true if a response was received; false otherwise
* @throws WebServiceClientException if there is a problem sending or receiving the message
*/
- boolean sendAndReceive(String uri, Source requestPayload, Result responseResult) throws WebServiceClientException;
+ boolean sendSourceAndReceiveToResult(String uri, Source requestPayload, Result responseResult)
+ throws WebServiceClientException;
/**
* Sends a web service message that contains the given payload. Writes the response, if any, to the given
@@ -197,8 +267,9 @@ public interface WebServiceOperations {
* @return true if a response was received; false otherwise
* @throws WebServiceClientException if there is a problem sending or receiving the message
*/
- boolean sendAndReceive(Source requestPayload, WebServiceMessageCallback requestCallback, Result responseResult)
- throws WebServiceClientException;
+ boolean sendSourceAndReceiveToResult(Source requestPayload,
+ WebServiceMessageCallback requestCallback,
+ Result responseResult) throws WebServiceClientException;
/**
* Sends a web service message that contains the given payload. Writes the response, if any, to the given
@@ -213,64 +284,9 @@ public interface WebServiceOperations {
* @return true if a response was received; false otherwise
* @throws WebServiceClientException if there is a problem sending or receiving the message
*/
- boolean sendAndReceive(String uri,
- Source requestPayload,
- WebServiceMessageCallback requestCallback,
- Result responseResult) throws WebServiceClientException;
+ boolean sendSourceAndReceiveToResult(String uri,
+ Source requestPayload,
+ WebServiceMessageCallback requestCallback,
+ Result responseResult) throws WebServiceClientException;
- /**
- * Sends a web service message that can be manipulated with the given callback, reading the result with a
- * WebServiceMessageExtractor.
- *
- * This will only work with a default uri specified!
- *
- * @param requestCallback the requestCallback to be used for manipulating the request message
- * @param responseExtractor object that will extract results
- * @return an arbitrary result object, as returned by the WebServiceMessageExtractor
- * @throws WebServiceClientException if there is a problem sending or receiving the message
- */
- Object sendAndReceive(WebServiceMessageCallback requestCallback, WebServiceMessageExtractor responseExtractor)
- throws WebServiceClientException;
-
- /**
- * Sends a web service message that can be manipulated with the given callback, reading the result with a
- * WebServiceMessageExtractor.
- *
- * @param uri the URI to send the message to
- * @param requestCallback the requestCallback to be used for manipulating the request message
- * @param responseExtractor object that will extract results
- * @return an arbitrary result object, as returned by the WebServiceMessageExtractor
- * @throws WebServiceClientException if there is a problem sending or receiving the message
- */
- Object sendAndReceive(String uri,
- WebServiceMessageCallback requestCallback,
- WebServiceMessageExtractor responseExtractor) throws WebServiceClientException;
-
- /**
- * Sends a web service message that can be manipulated with the given callback, reading the result with a
- * WebServiceMessageExtractor.
- *
- * This will only work with a default uri specified!
- *
- * @param requestCallback the callback to be used for manipulating the request message
- * @param responseCallback the callback to be used for manipulating the response message
- * @return true if a response was received; false otherwise
- * @throws WebServiceClientException if there is a problem sending or receiving the message
- */
- boolean sendAndReceive(WebServiceMessageCallback requestCallback, WebServiceMessageCallback responseCallback)
- throws WebServiceClientException;
-
- /**
- * Sends a web service message that can be manipulated with the given callback, reading the result with a
- * WebServiceMessageExtractor.
- *
- * @param uri the URI to send the message to
- * @param requestCallback the callback to be used for manipulating the request message
- * @param responseCallback the callback to be used for manipulating the response message
- * @return true if a response was received; false otherwise
- * @throws WebServiceClientException if there is a problem sending or receiving the message
- */
- boolean sendAndReceive(String uri,
- WebServiceMessageCallback requestCallback,
- WebServiceMessageCallback responseCallback) throws WebServiceClientException;
}
diff --git a/core/src/main/java/org/springframework/ws/client/core/WebServiceTemplate.java b/core/src/main/java/org/springframework/ws/client/core/WebServiceTemplate.java
index a49f6b08..af12bb71 100644
--- a/core/src/main/java/org/springframework/ws/client/core/WebServiceTemplate.java
+++ b/core/src/main/java/org/springframework/ws/client/core/WebServiceTemplate.java
@@ -64,24 +64,35 @@ import org.springframework.ws.transport.support.DefaultStrategiesHelper;
* FaultMessageResolver} can be defined with with {@link #setFaultMessageResolver(FaultMessageResolver)
* faultMessageResolver} property. If this property is set to null, no fault resolving is performed.
*
- * This template uses the following algorithm for sending and receiving. Source, marshalling, etc.2xx indicates an error. However, since a status code of 500 can also
- * indicate a SOAP fault, the template verifies whether the error is not a fault.null or falseSource, marshalling,
+ * etc.2xx indicates an error. However, since a
+ * status code of 500 can also indicate a SOAP fault, the template verifies whether the error is not a fault.null or false
* WebServiceTemplate template = new WebServiceTemplate(messageFactory);
* Result result = new DOMResult();
- * template.sendAndReceive(
+ * template.sendSourceAndReceiveToResult(
* new StringSource("<content xmlns=\"http://tempuri.org\"/>"),
* new SoapActionCallback("http://tempuri.org/SOAPAction"),
* result);
diff --git a/core/src/test/java/org/springframework/ws/client/core/WebServiceTemplateIntegrationTest.java b/core/src/test/java/org/springframework/ws/client/core/WebServiceTemplateIntegrationTest.java
index f65f7d73..dbbb36e4 100644
--- a/core/src/test/java/org/springframework/ws/client/core/WebServiceTemplateIntegrationTest.java
+++ b/core/src/test/java/org/springframework/ws/client/core/WebServiceTemplateIntegrationTest.java
@@ -88,10 +88,10 @@ public class WebServiceTemplateIntegrationTest extends XMLTestCase {
template.setMessageSender(new CommonsHttpMessageSender());
String content = " ";
StringResult result = new StringResult();
- template.sendAndReceive("http://localhost:8888/pox", new StringSource(content), result);
+ template.sendSourceAndReceiveToResult("http://localhost:8888/pox", new StringSource(content), result);
assertXMLEqual(content, result.toString());
try {
- template.sendAndReceive("http://localhost:8888/errors/notfound", new StringSource(content),
+ template.sendSourceAndReceiveToResult("http://localhost:8888/errors/notfound", new StringSource(content),
new StringResult());
fail("WebServiceTransportException expected");
}
@@ -99,7 +99,7 @@ public class WebServiceTemplateIntegrationTest extends XMLTestCase {
//expected
}
try {
- template.sendAndReceive("http://localhost:8888/errors/server", new StringSource(content), result);
+ template.sendSourceAndReceiveToResult("http://localhost:8888/errors/server", new StringSource(content), result);
fail("WebServiceTransportException expected");
}
catch (WebServiceTransportException ex) {
@@ -117,13 +117,13 @@ public class WebServiceTemplateIntegrationTest extends XMLTestCase {
template.setMessageSender(new CommonsHttpMessageSender());
String content = " ";
StringResult result = new StringResult();
- template.sendAndReceive("http://localhost:8888/soap/echo", new StringSource(content), result);
+ template.sendSourceAndReceiveToResult("http://localhost:8888/soap/echo", new StringSource(content), result);
assertXMLEqual(content, result.toString());
- boolean b = template.sendAndReceive("http://localhost:8888/soap/noResponse", new StringSource(content),
+ boolean b = template.sendSourceAndReceiveToResult("http://localhost:8888/soap/noResponse", new StringSource(content),
new StringResult());
assertFalse("Invalid result", b);
try {
- template.sendAndReceive("http://localhost:8888/errors/notfound", new StringSource(content),
+ template.sendSourceAndReceiveToResult("http://localhost:8888/errors/notfound", new StringSource(content),
new StringResult());
fail("WebServiceTransportException expected");
}
@@ -131,7 +131,7 @@ public class WebServiceTemplateIntegrationTest extends XMLTestCase {
//expected
}
try {
- template.sendAndReceive("http://localhost:8888/soap/fault", new StringSource(content), result);
+ template.sendSourceAndReceiveToResult("http://localhost:8888/soap/fault", new StringSource(content), result);
fail("SoapFaultClientException expected");
}
catch (SoapFaultClientException ex) {
diff --git a/core/src/test/java/org/springframework/ws/client/core/WebServiceTemplateTest.java b/core/src/test/java/org/springframework/ws/client/core/WebServiceTemplateTest.java
index 1a0251f6..d923c363 100644
--- a/core/src/test/java/org/springframework/ws/client/core/WebServiceTemplateTest.java
+++ b/core/src/test/java/org/springframework/ws/client/core/WebServiceTemplateTest.java
@@ -217,7 +217,7 @@ public class WebServiceTemplateTest extends XMLTestCase {
connectionMock.close();
connectionControl.replay();
- Object result = template.sendAndReceive(new StringSource(" "), extractorMock);
+ Object result = template.sendSourceAndReceive(new StringSource(" "), extractorMock);
assertEquals("Invalid response", extracted, result);
extractorControl.verify();
@@ -236,7 +236,7 @@ public class WebServiceTemplateTest extends XMLTestCase {
connectionMock.close();
connectionControl.replay();
- Object result = template.sendAndReceive(new StringSource(" "), extractorMock);
+ Object result = template.sendSourceAndReceive(new StringSource(" "), extractorMock);
assertNull("Invalid response", result);
extractorControl.verify();
@@ -254,7 +254,7 @@ public class WebServiceTemplateTest extends XMLTestCase {
connectionControl.replay();
StringResult result = new StringResult();
- boolean b = template.sendAndReceive(new StringSource(" "), result);
+ boolean b = template.sendSourceAndReceiveToResult(new StringSource(" "), result);
assertTrue("Invalid result", b);
connectionControl.verify();
@@ -270,7 +270,7 @@ public class WebServiceTemplateTest extends XMLTestCase {
connectionControl.replay();
StringResult result = new StringResult();
- boolean b = template.sendAndReceive(new StringSource(" "), result);
+ boolean b = template.sendSourceAndReceiveToResult(new StringSource(" "), result);
assertFalse("Invalid result", b);
connectionControl.verify();
@@ -381,8 +381,6 @@ public class WebServiceTemplateTest extends XMLTestCase {
callbackControl.verify();
extractorControl.verify();
connectionControl.verify();
-
}
-
-}
\ No newline at end of file
+}
diff --git a/pom.xml b/pom.xml
index 036de70b..38af4296 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,5 +1,6 @@
-
4.0.0
org.springframework.ws
@@ -256,7 +257,8 @@
+ tofile="target/site/reference/pdf/spring-ws-reference.pdf"
+ failonerror="false"/>
@@ -303,6 +305,7 @@
org.springframework.xml*
+ ${basedir}/src/main/javadoc
org.springframework.ws.samples
http://java.sun.com/j2se/1.4.2/docs/api
@@ -371,6 +374,11 @@
spring-ws-security
${project.version}
+
+ org.springframework.ws
+ spring-ws-mock
+ ${project.version}
+
org.springframework.ws
spring-ws-samples
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 97c7ec62..c5396b75 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -6,6 +6,8 @@
+ Reduce the number of overloaded methods on the
+ WebServiceTemplate class to aid comprehension.
Allow specifying names of message factory and message
receiver in MessageDispatcherServlet