From 71c61a95fe995fc810751f8f80dcec836ccfd2a5 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Sun, 11 Nov 2007 14:06:54 +0000 Subject: [PATCH] Added JMS documentation --- src/docbkx/client.xml | 6 +- src/docbkx/oxm.xml | 3 +- src/docbkx/server.xml | 130 ++++++++++++++++++++++++++++-------------- 3 files changed, 92 insertions(+), 47 deletions(-) diff --git a/src/docbkx/client.xml b/src/docbkx/client.xml index a59e3e0b..de993540 100644 --- a/src/docbkx/client.xml +++ b/src/docbkx/client.xml @@ -117,7 +117,8 @@ import org.springframework.ws.transport.WebServiceMessageSender; public class WebServiceClient { - private static final String MESSAGE = "Hello Web Service World"; + private static final String MESSAGE = + "Hello Web Service World"; private final WebServiceTemplate webServiceTemplate = new WebServiceTemplate(); @@ -136,7 +137,8 @@ public class WebServiceClient { public void customSendAndReceive() { StreamSource source = new StreamSource(new StringReader(MESSAGE)); StreamResult result = new StreamResult(System.out); - webServiceTemplate.sendSourceAndReceiveToResult("http://localhost:8080/AnotherWebService", source, result); + webServiceTemplate.sendSourceAndReceiveToResult("http://localhost:8080/AnotherWebService", + source, result); } }]]> diff --git a/src/docbkx/oxm.xml b/src/docbkx/oxm.xml index 8868dbcc..e2ce51cc 100644 --- a/src/docbkx/oxm.xml +++ b/src/docbkx/oxm.xml @@ -275,7 +275,8 @@ public class Application { } public static void main(String[] args) throws IOException { - ApplicationContext appContext = new ClassPathXmlApplicationContext("applicationContext.xml"); + ApplicationContext appContext = + new ClassPathXmlApplicationContext("applicationContext.xml"); Application application = (Application) appContext.getBean("application"); application.saveSettings(); application.loadSettings(); diff --git a/src/docbkx/server.xml b/src/docbkx/server.xml index 619b29a3..4237f9e5 100644 --- a/src/docbkx/server.xml +++ b/src/docbkx/server.xml @@ -100,9 +100,16 @@ WebServiceMessageReceiverHandlerAdapter, which is a Spring Web HandlerInterceptor, so that the MessageDispatcher can be wired in a standard DispatcherServlet. There is a more convenient way to do - this, however, which is shown in the next section. + this, however, which is shown in . -
+
+
+ Transports + + Spring Web Services supports multiple transport protocols. The most common is the HTTP transport, for which + a custom servlet is supplied, but it is also possible to send messages over JMS, and even email. + +
<classname>MessageDispatcherServlet</classname> The MessageDispatcherServlet is a standard Servlet @@ -200,23 +207,13 @@ Consult the class-level Javadoc on the WsdlDefinitionHandlerAdapter class which explains the whole transformation process in more detail. -
- Exposing a static WSDL - - As indicated above, a static WSDL file can be exposed by using the - SimpleWsdl11Definition. Simply wire it up, and give it a - Resource for the wsdl property, or use the - contructor, as shown in the example above. - -
-
- Dynamically creating a WSDL from an XSD - - As shown in , Spring Web Services can generate a WSDL - file from a XSD schema, using conventions. The next application context snippet shows how to - create such a dynamic WSDL file: - - + As an alternative to writing the WSDL by hand, and exposing it with the + SimpleWsdl11Definition, Spring Web Services can also generate a WSDL + from an XSD schema. This is the approach shown in . + The next application context snippet shows how to create such a dynamic WSDL file: + + @@ -226,28 +223,27 @@ ]]> - - The DynamicWsdl11Definition uses a - Wsdl11DefinitionBuilder implementation - to generate a WSDL the first time it is requested. - Typically, we use a XsdBasedSoap11Wsdl4jDefinitionBuilder, which builds - a WSDL from a XSD schema. This builder iterates over all element elements - found in the schema, and creates a message for elements that end with the - defined request or response suffix. The default request suffix is Request; - the default response suffix is Response, though these can be changed by - setting the requestSuffix and responseSuffix - properties, respectively. - Next, the builder combines the request and response messages into a WSDL - operations, and builds a portType based on the operations. - - - For instance, if our Orders.xsd schema defines the - GetOrdersRequest and GetOrdersResponse elements, the - XsdBasedSoap11Wsdl4jDefinitionBuilder will create a - GetOrdersRequest and GetOrdersResponse message, and a - GetOrders operation, which is put in a Orders port type. - -
+ + The DynamicWsdl11Definition uses a + Wsdl11DefinitionBuilder implementation + to generate a WSDL the first time it is requested. + Typically, we use a XsdBasedSoap11Wsdl4jDefinitionBuilder, which builds + a WSDL from a XSD schema. This builder iterates over all element elements + found in the schema, and creates a message for elements that end with the + defined request or response suffix. The default request suffix is Request; + the default response suffix is Response, though these can be changed by + setting the requestSuffix and responseSuffix + properties, respectively. + Next, the builder combines the request and response messages into a WSDL + operations, and builds a portType based on the operations. + + + For instance, if our Orders.xsd schema defines the + GetOrdersRequest and GetOrdersResponse elements, the + XsdBasedSoap11Wsdl4jDefinitionBuilder will create a + GetOrdersRequest and GetOrdersResponse message, and a + GetOrders operation, which is put in a Orders port type. +
@@ -261,7 +257,7 @@ MessageDispatcher by adding a WebServiceMessageReceiverHandlerAdapter to the servlet's web application context: - + @@ -269,17 +265,63 @@ + ... - ]]> + +]]> Note that by explicitely adding the WebServiceMessageReceiverHandlerAdapter, the dispatcher servlet does not load the default adapters, and is unable to handle standard Spring-MVC Controllers. Therefore, we add the SimpleControllerHandlerAdapter at the end.
+
+ JMS transport + + Spring Web Services supports server-side JMS handling through the JMS functionality provided in the + Spring framework. Spring Web Services provides the WebServiceMessageListener + to plug in to a MessageListenerContainer. The following piece of configuration + shows this: + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + As an alternative to the WebServiceMessageListener, Spring Web Services provides + a WebServiceMessageDrivenBean, an EJB + MessageDrivenBean. For more information on EJB, refer to the class level + Javadocs of the WebServiceMessageDrivenBean. + +
Endpoints