Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop web services - Invocation framework (WSIF) > Use WSIF to invoke web services > Link a WSIF service to the underlying implementation of the service > Link a WSIF service to a JMS-provided service


Write the WSDL extensions that let your WSIF service access a service at a JMS destination

Use the native Java Message Service (JMS) provider, Web Services Invocation Framework (WSIF) clients can treat a service that is available at a JMS destination as a Web service. Use this information, and associated code fragments, to help you to write the WSDL extensions. This topic assumes that you chose and configured a JMS provider when you installed WAS (either the default messaging provider, or another provider such as the WebSphere MQ messaging provider). If not, do so now as described in Choosing a messaging provider.

The WSDL extensions for JMS are identified with the namespace prefix jms. For example, <jms:binding>.

The supported operations are either one-way operations (send for JMS point-to-point messaging, or publish for JMS publish and subscribe messaging) or request-response operations (send and receive for JMS point-to-point messaging). The WSDL operations therefore specify either an input message only, or an input and an output message.

Operations that describe message interfaces with a native JMS binding do not have fault messages. No assumptions are made about the message schema or the semantics of message properties, therefore no distinction can be made between output and fault messages.

Use the following procedure, and associated code fragments, to help you to write the WSDL extensions that enable your WSIF service to access an underlying service at a JMS destination.


Procedure


Example

Example 1: JMS Text Message

The JMS text message contains a java.lang.String. In this example, the WSDL message contains only one part that represents the whole message body:

<wsdl:definitions ... >


<!-- simple or complex types for input and output message -->
<wsdl:types> ...
</wsdl:types>

<wsdl:message name="JmsOperationRequest"> ...
</wsdl:message>
<wsdl:message name="JmsOperationResponse"> ...
</wsdl:message>

<wsdl:portType name="JmsPortType">
<wsdl:operation name="JmsOperation">   
<wsdl:input name="Request"
                     message="tns:JmsOperationRequest"/>   
<wsdl:output name="Response"
                      message="tns:JmsOperationResponse"/>
</wsdl:operation>
</wsdl:portType>

<wsdl:binding name="JmsBinding" type="JmsPortType">
<jms:binding type="TextMessage" />

<format:typemapping style="Java" encoding="Java">    
  
<format:typemap name="xsd:String" formatType="String" />
</format:typemapping>

<wsdl:operation name="JmsOperation">   
<wsdl:input message="JmsOperationRequest">      
<jms:input parts="requestMessageBody" />   
</wsdl:input>   
<wsdl:output message="JmsOperationResponse">      
<jms:output parts="responseMessageBody" />   
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<wsdl:service name="JmsService">
<wsdl:port name="JmsPort" binding="JmsBinding">   
<jms:address destinationStyle="queue"
                      jndiConnectionFactoryName="myQCF"
                      jndiDestinationName="myDestination"/>
</wsdl:port>
</wsdl:service>

</wsdl:definitions>

As an extension to the previous JMS message example, the following example WSDL describes a request-response operation in which specific JMS property values of the request and response message are set for the request message and retrieved from the response message.

The JMS properties in the request message are set according to the values in the input message. Likewise, selected JMS properties of the response message are copied to the corresponding values of the output message. The direction of the mapping is determined by the appearance of the <jms:property> tag in the input or output section, respectively.

Example 2: JMS Message with JMS Properties

<wsdl:definitions ... >


<!-- simple or complex types for input and output message -->
<wsdl:types> ...
</wsdl:types>

<wsdl:message name="JmsOperationRequest">

<wsdl:part name="myInt" type="xsd:int"/>       ...

</wsdl:message>

<wsdl:message name="JmsOperationResponse">

<wsdl:part name="myString" type="xsd:String"/>       ...

</wsdl:message>

<wsdl:portType name="JmsPortType">
<wsdl:operation name="JmsOperation">   
<wsdl:input name="Request"
                     message="tns:JmsOperationRequest"/>   
<wsdl:output name="Response"
                      message="tns:JmsOperationResponse"/>
</wsdl:operation>
</wsdl:portType>

<wsdl:binding name="JmsBinding" type="JmsPortType">
<!-- the JMS message type might be any of the above -->
<jms:binding type="..." />

<format:typemapping style="Java" encoding="Java">    
  
<format:typemap name="xsd:int" formatType="int" />          ...

</format:typemapping>

<wsdl:operation name="JmsOperation">   
<wsdl:input message="JmsOperationRequest">      
<jms:property message="tns:JmsOperationRequest" parts="myInt" />      
<jms:propertyValue name="myLiteralString"
                          type="xsd:string" value="Hello World" />             ...
  
</wsdl:input>   
<wsdl:output message="JmsOperationResponse">      
<jms:property message="tns:JmsOperationResponse" parts="myString" />             ...
  
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<wsdl:service name="JmsService">
<wsdl:port name="JmsPort" binding="JmsBinding">   
<jms:address destinationStyle="queue"
                      jndiConnectionFactoryName="myQCF"
                      jndiDestinationName="myDestination"/>
</wsdl:port>
</wsdl:service>

</wsdl:definitions>

WSIF and WSDL
Write the WSDL extension that lets your WSIF service access a SOAP over JMS service
Enable a WSIF client to invoke a web service through JMS
Link a WSIF service to a JMS-provided service


Related


JMS message header: The TimeToLive property reference

+

Search Tips   |   Advanced Search