Chapter 12. JAX-WS JMS Transport

Table of Contents

12.1. Overview
12.2. Configuring JAX-WS JMS Transport
12.2.1. Configuring a JMS Server
12.2.2. Creating a Web Service
12.2.3. Configuring a WSDL
12.2.4. Creating a Web Service Client

This chapter describes JAX-WS JMS transport in web services.

12.1. Overview

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.

12.2. Configuring JAX-WS JMS Transport

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.

12.2.1. Configuring a JMS Server

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>


12.2.2. Creating a Web Service

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(
    jndiConnectionFactoryName = "QueueConnectionFactory",
    destinationName = "ExamplesQueue",
    targetService = "AddNumbersImplService")
public class AddNumbersImpl {
...


The following are the JMS WebService properties.

PropertyDescription
jndiConnectionFactoryNameConnectionFactory name of the JMS Server. It should be identical to the value, domain.xml#<connection-factory>/< name>.
destinationNameDestination name of the JMS Server. It should be identical to the value, domain.xml#<destination>/<name>.
targetService

Service endpoint implementation that will send the message arrived at the destination. If the property is not specified in the fromJava model, the wsdl:service name is used as the targetService property value. Must be identical to the JMS URI targetService property value in the fromWSDL model.

12.2.3. Configuring a WSDL

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 JMS URI in wsdl:port's soap:address 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="http://<host>:<port>/<context>/AddNumbersService" />
    </port>
    <port name="AddNumbersJMSPort" binding="impl:AddNumbersBinding">
        <soap:address location="jms:jndi:ExamplesQueue?targetService=AddNumbers
ImplService&jndiConnectionFactoryName=QueueConnectionFactory" />
    </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.

SOAP/JMS' JMS URI must be specified according to the 'SOAP over Java Message Service 1.0' standard.

JMS URI uses the "jms" scheme, and specifies the destination name to query JMS destination with JNDI.

JMS URI's targetService property must be identical to the web service endpoint's @JMSWebService#targetService property value.

12.2.4. Creating a Web Service Client

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();
...