Skip to end of metadata
Go to start of metadata

Overview

How to setup webMethods to send/receive using a Websphere MQ JMS server in a request/reply scenario.

In the use case webMethods receives a message and sends it to an MQ server expecting SAP to pick up the message, process it and reply back - a MessageRequestor adapter service is used.

For development/testing purposes webMethods will also act as the consumer and reply to the initiating process. A trigger is created to receive the inbound message, processing is performed and a response is sent using the pub.jms:reply. The initiator should receive the response and complete the process.

The WMQ Adapter is not used instead the generic JMS Adapter is used.

Prerequisites

Requires WebSphere 7 (should work with 6 too) + WebSphere explorer
Requires webMethods + WmJMSAdapter (not strictly but used in this example) + JMS_6-1_Fix12

WebSphere configuration

Queue

If a queue named 'default' does not exist, create one by right clicking the 'Queues' folder under the default Queue Manager and selecting 'New' -> 'Local Queue'. Give the queue a name of 'default' click 'Next' then leave the default settings and click Finish.

Client Connection

Create a new client-connection (for webMethods) by expanding 'Advanced' under the default Queue Manager right click 'Client Connections' and select 'New' -> 'Client connection Channel'. Give the channel a name of 'webMethods' click 'Next' then enter the Queue Manager name and enter a connection name of 'webMethods'. Leave the remaining settings at default values and click Finish.

JMS Administered Objects (JNDI)

Right click JMS Administered Objects and select 'Add Initial Context'. Specify the JNDI namespace to be located on the 'File System'. Choose a directory for the bindings 'C:/opt/IBM/jndi'. Leave the context nickname and check 'Connect immediately on finish'.

Now under the new administered object right click 'Connection Factories' and select 'New' -> 'Connection Factory'. Give the name 'connectionFactory', leave the messaging provider as 'WebSphere MQ' and click Next. Leave the Type as 'Connection Factory' and click Next, select the Transport as 'Client'. Click through Next and Finish leaving the remaining values at default.

Under the same administered object right click 'Destinations' and select 'New' -> 'Destination'. Give the name 'defaultDestination', leave type as 'Queue' and click Next, click Next again and then enter the same Queue Manager name and select the queue 'default'.

webMethods Configuration

JMS Adapter installation

Install the WmJMSAdapter package.

Copy the following files to <ISHOME>/lib/jars:

  • com.ibm.mq.jar
  • com.ibm.mq.pcf-6.0.3.jar
  • com.ibm.mqjms.jar
  • dhbcore.jar
  • jms.jar
  • jndi.jar
  • mqcontext.jar
  • pcf.jar
  • wmjmsnaming.jar
  • wmjms.zip

Apply JMS_6-1_Fix12 (install the jar using the package management screen).

Restart IS.

JMS Adapter Connection

Setup the connection by clicking 'JMS Adapter' under Adapters from the Administration console. Click 'Configure New Connection' with the following settings:

Field

Value

Notes

Transaction Type

NO_TRANSACTION

 

JNDI Initial Context Factory

com.ibm.mq.jms.context.WMQInitialContextFactory

 

JNDI Provider URL

127.0.0.1:1414/SYSTEM.DEF.SVRCONN

Default local IP/port the

JNDI Security Principal

 

 

JNDI Security Credentials

 

Might be populated for you if you leave it blank

JNDI Other Properties

 

 

QueueConnectionFactory JNDI Name

QM_<machine_name>

Queue Manager name, defaults to QM_<machine_name>

JMS user

 

 

JMS password

 

Might be populated for you if you leave it blank

Leave the connection management properties at defaults.

Ensure the connection is enabled.

JNDI Alias

Setup the JNDI alias by clicking 'Messaging' under Settings from the Administration console. Click 'JNDI settings' then 'Create JNDI Provider Alias' with the following settings:

Field

Value

Notes

JNDI Alias Name

jms jndi

Name for the JNDI alias

Description

jms jdni

Description of the JNDI alias

Initial Context Factory

com.sun.jndi.fscontext.RefFSContextFactory

The JNDI initial context factory

Provider URL

file:/C:/opt/IBM/jndi

The JNDI provider url

Security Principal

 

 

Security Credentials

 

 

Other Properties

 

 

Test the lookup.

JMS Alias

Setup the JMS alias by clicking 'Messaging' under Settings from the Administration console. Click 'JMS settings' then 'Create JMS Connection Alias' with the following settings:

Field

Value

Notes

Connection Alias Name

local_jms

Name for the JMS alias

Description

local_jms

Description for the JMS alias

Transaction Type

NO_TRANSACTION

Transaction type for the alias

Connection Client ID

webmethods

The connection client id

User (optional)

 

 

Password (optional)

 

 

Create Connection Using

JNDI Lookup

 

JNDI Provider Alias Name

jms jndi

 

Connection Factory Lookup Name

connectionFactory

 

Class Loader

INTEGRATION_SERVER

 

Maximum CSQ Size (number of documents)

UNLIMITED

 

Drain CSQ In Order

Yes

 

Ensure the alias is enabled.

JMS Adapter Services

Now you can create JMS adapter services using the JMS adapter connection and pre-defined templates.

Create MessageRequestor, DocumentToTextMessage and TextMessageToDocument services.

Use the DocumentToTextMessage service to convert your message to a JMS Message, then pass this to the MessageRequestor with the inbound queue as the destination (default). Once you have received a response you can convert the response JMS Message back to a normal message using the TextMessageToDocument service.

JMS Triggers

Now you can create JMS triggers using the JMS destinations available through JNDI.

  1. Set the JMS connection alias name to the previously configured JMS alias.
  2. Set the destinationName to the destination which is connected to the inbound message queue (defaultDestination).
  3. Set the message routing rule to invoke a 'back-end' service which will take the message, process it and eventually reply.

JMS Services (native)

The service which is invoked by the trigger should take as input a JMSMessage (pub.jms:JMSMessage). It can then process the message, and then call pub.jms:reply with the response. The trigger will have propagated the reply context.
create a response and use a DocumentToTextMessage service to convert the response to a JMS Message

Notes

An adapter service is not used for the reply portion. The adapter service for message producing will not work as a response message in the request/reply scenario as it will not access the temporary queue where the initiating process is expecting the response message. As such, the pub.jms:reply service is used directly rather than an adapter service.

Labels
  • None