Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Use WebSphere MQ in SOAP over JMS Web services, Part 1: Deploy and configure your Web service

Mohab El-Hilaly (MOHABH@eg.ibm.com), Software Engineer, IBM
Mohab El-Hilaly works as a Software Engineer at IBM Cairo Technology Development Center, Egypt, where he develops and designs custom solutions using Websphere Enterprise Service Bus technology for various customers. Prior to that he developed custom solutions using various Microsoft Technologies, mainly ASP.NET. He obtained a bachelors degree in Computer Science from the American University in Cairo. In his spare time he enjoys watching soccer and playing console games
Islam H. Azaz (islama@eg.ibm.com), IT Architect, IBM
Islam Hussein Azaz is an Advisory IT Architect and has worked for IBM since 2003. He is currently working as a BPM Consultant for IBM Software Services for WebSphere (ISSW). Islam is a Sun Certified Enterprise Architect (SCEA) for JavaEE5.
Alaa Youssef (AYOUSSEF@eg.ibm.com), IT Architect, IBM
Alaa Youssef works as an IT Architect at IBM Cairo Technology Development Center, Egypt, where he helps IBM's customers in devising SOA solutions. From 1998 till mid 2005, he worked as a Research Staff Member at IBM T.J. Watson Research Center, New York. He received the PhD degree in computer science in 1998 from Old Dominion University, Virginia, USA. He received the BS and MS degrees in computer science from Alexandria University, Egypt, in 1991 and 1994, respectively. He has authored several papers, and patents.

Summary:  SOAP over Java™ Message Service (JMS) is an alternative messaging mechanism to SOAP over HTTP. Using SOAP over JMS for Web services offers more reliable and scalable messaging support than does SOAP over HTTP. Although JMS providers may not be interoperable across platforms, you can use SOAP over JMS inside the enterprise, especially if the enterprise uses Message Oriented Middleware (MOM). Because IBM® WebSphere® MQ is one of the most widely used messaging platforms, this article shows you how to develop, deploy, and test a sample Web service with SOAP over JMS binding using WebSphere MQ as its messaging provider. Configurations that are unique to WebSphere MQ or IBM WebSphere Application Server are specifically addressed.

Date:  22 Dec 2008
Level:  Intermediate PDF:  A4 and Letter (853KB | 22 pages)Get Adobe® Reader®
Also available in:   Russian

Activity:  20885 views
Comments:  

Introduction

SOAP is transport-independent and can be bound to any protocol; SOAP over JMS is an alternative messaging mechanism to the standard SOAP over HTTP messaging. SOAP over JMS is proven to be more reliable and scalable than SOAP over HTTP. Its reliability and scalability reflect the reliability and scalability of WebSphere MQ, the messaging engine used as the JMS provider in our case. It is reliable because message delivery is guaranteed, and scalable because it can support high-volume connections.

SOAP over JMS also allows a Web service client to asynchronously invoke a service without waiting for the response. Although asynchronous invocation style can be implemented by both synchronous and asynchronous transport protocols, JMS makes the implementation of asynchronous invocation easier for both the service requestor and service provider.

Scenario used in this article

This article shows how a Web service client can invoke a Web service by putting a JMS message into a WebSphere MQ queue (Input queue) and then receive the response as a JMS message from another queue (the Response queue). It illustrates how to configure a sample Web service deployed on IBM WebSphere Application Server V6.1 to use MQ queues as its input and response queues. For testing purposes, we will use RFH2Util (a widely used WebSphere MQ testing utility) as the Web service client. Figure 1 shows the topology of our scenario:


Figure 1. Topology used in the article
Topology

The Web service will need a number of JMS resources or managed objects to be defined in the application server. Let's look at what these are:

Reply-to queue

In order for this sample to work, the reply-to queue specified in the request message has to exist in the MQ queue manager referenced by the Reply Queue Connection Factory. Requests referencing the reply-to queue outside that Queue manager will fail at response.
  1. JMS Listener Port: Used by the Web service to collect the SOAP/JMS request messages from the request queue. The listener port is used by WebSphere Application Server runtime to pull the request queue to collect SOAP/JMS messages and pass it to activate the Web service.
  2. JMS Request Queue Connection Factory: Used by the listener port to connect to the MQ queue manager that hosts the request MQ queue.
  3. JMS Request Queue: The JMS managed object that represents the request MQ queue. It is used by the Web service to collect SOAP/JMS messages from the request queue.
  4. JMS Reply Queue Connection Factory: Used by the Web service to connect to the MQ queue manager that hosts the reply MQ queue.

Getting started

These prerequisites should be installed in order for this sample to work smoothly:

Queue Managers

We used a single MQ queue manager to host both the request and response queues, yet the steps assume that we used different queue managers. That's why we created two JMS Queue Connection Factories.

  1. WebSphere MQ should be already installed on the system, with a queue manager, a request queue, and a reply queue. (V6 is used in this article, but the same steps work fine with V5 and V7.)
  2. WebSphere Application Server should be installed and configured.
  3. Some development environment should be installed; this could be IBM Rational® Solution Architect or IBM WebSphere Integration Developer.

With all the prerequisites installed and configured, you are ready to begin configuration on WebSphere Application Server. We first configure the Queue Connection Factories for both the request and response queues.

  1. Start WebSphere Application Server.
  2. Run the Administrative console on WebSphere Application Server.
  3. In the next few steps, we will set up the Queue connection factories for the request queue and then create the reply queue connection factory.
  4. Click on Queue connection factories as shown in Figure 2.

    Figure 2. Queue Connection Factories
    Queue Connection Factories

  5. Choose the required scope and click New.

    Figure 3. Queue Connection Factories
    New Queue Connection Factories

  6. Choose WebSphere MQ messaging provider.

    Figure 4. Queue Connection Factory Message Provider
    QCF Message Provider

  7. Fill in the following, and then click Save.
    • For the name, choose an appropriate name.
    • For the JNDI name, type jms/ReqQCF.
    • Insert the queue manager name, host, and port. (This information comes from the pre-installed WebSphere MQ.)
    • For Transport, choose Client.


    Figure 5. Queue Connection Factory Properties
    Queue Connection Factory Properties

    Repeat the same steps for the reply Queue connection factory but with the Web services name being WebServicesReplyQCF and the JNDI name being jms/WebServicesReplyQCF.

    In the next few steps, we will create the request queue, where messages will be placed in the order that the Web service is consumed.

  8. Click Queues.
  9. Choose the required scope and click New.

    Figure 6. Create New Queue
    Create New Queue

  10. Fill in the following values:
    • For the name, choose an appropriate name.
    • For the JNDI name, type jms/ReqQ.
    • Insert the queue manager name, host, and port.
    • Fill in the base Queue name that is hosted on MQ.
    • Click OK and then Save.


    Figure 7. Queue Properties
    Queue Properties

    Why is there no reply queue?

    The reply queue is the responsibility of the consumer to create and use. WebServicesReplyQCF will use the ReplyTo field in the JMS header as the reply queue to place the response in, so there is no need to create one.

  11. Now we need to create a listener in order to detect that a message is placed in the queue, which in turn will be consumed by the service.
  12. From the Application Server administrative console, select Servers. Your application server will most likely be server1. Under "Communications," expand "Messaging" and select Message Listener Service.

    Figure 8. Message Ports
    Message Ports

  13. Click Listener Ports:

    Figure 9. Listener Ports
    Listener Ports

  14. Click New.
  15. Fill in the following Values:
    • For the name, type MQListener.
    • For the connection factory, type jms/ReqQCF.
    • For the queue, type jms/ReqQ.
    • Click OK and then Save.


    Figure 10. Listener Ports Properties
    Listener Ports Properties

  16. Restart WebSphere Application Server, and you are now ready to deploy and run a SOAP/JMS Web service.

Importing and deploying the Web service

After the previous server configurations, the Web service is ready to be deployed and tested. Now we need to import, build the project interchange, and deploy it on the server.

  1. In Project Explorer, click File > Import:

    Figure 11. Project Explorer
    Project Explorer

  2. Select Project Interchange and click Next:

    Figure 12. Select Project Interchange
    Select Project Interchange

  3. Browse to the location of the downloaded Project Interchange file called "DeveloperWorksService.zip" (see the Downloads section of this article). Choose all files and then click Finish.

    Figure 13. Browse Project Interchange
    Browse for file

  4. Clean and build the workspace by going to the Project menu and clicking Clean.
  5. Add the Project to the server:

    Figure 14. Add Project to server
    Add Project to server

  6. Restart the application server, and now you are ready to test the Web service.

Testing the Web service

Basic testing will ensure that the Web service is configured and functioning correctly. There are several different methods of testing an asynchronous Web service. If you choose the method described below, you need a JMS client with the ability to insert messages on an MQ queue.

The method below uses a tool that is shipped with the Message broker called rfutil. This tool facilitates the insertion and retrieval of messages on MQ queues. It also gives you the option to alter message JMS header properties as required for the Web service to function.

If you download the RFHUtil sample file as described here, be aware that you need to alter the Queue Manager, Queue Name, and the JMS replyTo according to the MQ configurations on your local environment.

The steps below test whether the Web service is listening on the Destination queues, where the request message is inserted. It also tests whether the Web service uses the JMS Reply To header to send the response.

  1. Open RFHUtil.
  2. Click File > Open. Choose the file SampleRFHUtil, which you can download below (see Downloads).

    Figure 15. Open Sample RFHUtil text file
    Sample RFHUtil test file

  3. Change the following attributes to match to your local environment:
    • Queue Manager Name
    • Queue Name
    • Under the MQMD tab, Reply to Queue Manager name and Reply Queue
    • Under the jms tab, Reply To and Destination name
  4. Under the Main tab, click Write Q:

    Figure 16. Write Input to Queue
     Write Input to Queue

  5. Change the Queue name to the response queue (which should be the same value as the Reply To in the JMS Header) and click Read Q.
  6. Switch to the Data tab and observe the response Data.

Conclusion

The steps in this article walked you through developing, deploying, and testing a Web service with SOAP over JMS binding using WebSphere MQ as the messaging provider. SOAP over JMS for Web services offers more reliable and scalable messaging support than does SOAP over HTTP.

Downloads

DescriptionNameSizeDownload method
Sample JMS Web ServiceDeveloperWorksService.zip9KB HTTP
Sample RFHUtil inputSampleRFHUtil.zip1KB HTTP

Information about download methods


Resources

Learn

Get products and technologies

  • Download IBM product evaluation versions and get your hands on application development tools and middleware products from DB2®, Lotus®, Rational®, Tivoli®, and WebSphere®.

Discuss

About the authors

Mohab El-Hilaly works as a Software Engineer at IBM Cairo Technology Development Center, Egypt, where he develops and designs custom solutions using Websphere Enterprise Service Bus technology for various customers. Prior to that he developed custom solutions using various Microsoft Technologies, mainly ASP.NET. He obtained a bachelors degree in Computer Science from the American University in Cairo. In his spare time he enjoys watching soccer and playing console games

Islam Hussein Azaz is an Advisory IT Architect and has worked for IBM since 2003. He is currently working as a BPM Consultant for IBM Software Services for WebSphere (ISSW). Islam is a Sun Certified Enterprise Architect (SCEA) for JavaEE5.

Alaa Youssef works as an IT Architect at IBM Cairo Technology Development Center, Egypt, where he helps IBM's customers in devising SOA solutions. From 1998 till mid 2005, he worked as a Research Staff Member at IBM T.J. Watson Research Center, New York. He received the PhD degree in computer science in 1998 from Old Dominion University, Virginia, USA. He received the BS and MS degrees in computer science from Alexandria University, Egypt, in 1991 and 1994, respectively. He has authored several papers, and patents.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

static.content.url=/developerworks/js/artrating/
SITE_ID=1
Zone=SOA and Web services, WebSphere
ArticleID=360653
ArticleTitle=Use WebSphere MQ in SOAP over JMS Web services, Part 1: Deploy and configure your Web service
publish-date=12222008
author1-email=MOHABH@eg.ibm.com
author1-email-cc=
author2-email=islama@eg.ibm.com
author2-email-cc=
author3-email=AYOUSSEF@eg.ibm.com
author3-email-cc=