Table of Contents
This chapter describes JAX-WS JMS transport in web services.
In general, JEUS JAX-WS can invoke JEUS web services by using JMS transport, while web service client applications use HTTP to invoke web services.
JAX-WS JMS transport uses the ConnectionFactory and Destination settings of the JEUS MQ server. The web service that uses JAX-WS JMS transport adds the @jeus.webservices.jaxws.api.JMSWebService annotation to the web service endpoint.
If a web service that is using JAX-WS JMS transport is deployed, two wsdl:port elements are defined in the distributed WSDL, an HTTP port and JMS port. The web service client application can choose any type of port to invoke the web service.
This section describes how to configure JAX-WS JMS transport with the assumption that the developer is familiar with JAX-WS web services and JMS.
JAX-WS JMS transport works on a JMS server by using the ConnectionFactory and Destination properties of the server. JAX-WS JMS transport uses a queue type as a Destination. A <connection-factory and <destination> properties must be configured in the domain.xml file on the JEUS MQ server. Refer to "JEUS MQ Guide" for detailed information about the configuration.
The following is an example of configuring JAX-WS JMS transport.
[Example 12.1] << domain.xml >>
<jms-engine xmlns="http://www.tmaxsoft.com/xml/ns/jeus"> ... <connection-factory> <type>queue</type> <name>QueueConnectionFactory</name> <service>jmstest</service> </connection-factory> ... </jms-engine> <jms-resource> ... <destination> <type>queue</type> <name>ExamplesQueue</name> <multiple-receiver>true</multiple-receiver> </destination> ... </jms-resource>
To use JMS transport instead of HTTP, add the @jeus.webservices.jaxws.api.JMSWebService annotation to the web service endpoint.
The following is a web service endpoint that includes the @JMSWebService annotation.
[Example 12.2] << AddNumbersImpl.java >>
@WebService @jeus.webservices.jaxws.api.JMSWebService( connectionFactory = "QueueConnectionFactory", destination = "ExamplesQueue", portName = "AddNumbersJMSPort") public class AddNumbersImpl { ...
The following are the JMS WebService properties.
To create a web service endpoint from WSDL, a wsdl:port for JMS transport and a wsdl:port that uses HTTP must be configured in the WSDL of the deployed application (WAR or JAR).
The following is an example of specifying wsdl:port for JAX-WS JMS transport in WSDL.
[Example 12.3] << AddNumbers.wsdl >>
<definitions name="AddNumbers" targetNamespace="urn:AddNumbers" ... > ... <service name="AddNumbersService"> <port name="AddNumbersPort" binding="impl:AddNumbersBinding"> <soap:address location="REPLACE_WITH_ACTUAL_URL" /> </port> <port name="AddNumbersJMSPort" binding="impl:AddNumbersBinding"> <soap:address location="REPLACE_WITH_ACTUAL_URL" /> </port> </service> </definitions>
A <port name> in wsdl:port for JMS transport must be identical to the @JMSWebService#portName property value of the web service endpoint.
A web service client that uses JAX-WS JMS transport can call a web service through JMS by using a JMS port instead of the existing HTTP port.
The published WSDL of the web service has the wsdl:port information that is used for JMS transport. A service class that extends javax.xml.ws.Service created from the WSDL through the wsimport tool has a method for obtaining a JMS port, and one for obtaining the existing HTTP port.
As shown in the following example, a web service client application can invoke a web service by selecting a port type.
[Example 12.4] << AddNumbersClient.java >>
//AddNumbersPortType port = new AddNumbersService().getAddNumbersPort(); AddNumbersPortType port = new AddNumbersService().getAddNumbersJMSPort(); ...