Portus Version 2018-08-24
 

SOAP over IBM MQ Series Tutorial

Tutorial: Send SOAP requests to MQ

Portus and IBM MQ Series can be used together to enable sending SOAP requests to an MQ queue and to receive a response from a queue.

These request are asynchronous so it means that multiple requests may be sent from the client even though Portus may not be running.

These requests are held on the queue until Portus reads and processes them. Likewise the responses will reside on a queue until such time that a client may request them.

Here is a top level view on the steps involved.

Details

This tutorial will make use of Java wrapper/stub classes to access a Portus web service.

Java wrapper/stub classes are generated using the Apache Axis2 feature WSDL2Java.

If you do not have it already, download and install the latest Axis2 kit.

The web service which we will be using is that generated by discovering the city table in the World database supplied by a MySQL installation. See MySQL Tutorials for details on how this is achieved.

Ensure that the MQ Manager to be used has been started and that an input and output queue created. Also ensure that a listener has been started.

  1. Select the world_dsn_city web service and open the Messaging tab. Select the MQ radio button and tab. Fill in the details appropriate to your MQ installation.

  2. As per the hint, switch back to Service properties and select the Save button when complete.

  3. Portus will now make contact with the appropriate messaging system. If an error occurs it will be highlighted as follows.

    Check the error_log to find the cause. The default location of the Apache error_log is [SERVER_INST]/Apache22/logs/error_log replacing [SERVER_INST] with the location in which you have installed Portus. Please correct and try again.

    If successful then carry on to next step.

  4. Switch to the Java perspective (Window -> Open Perspective -> Other... -> Java (default). For more information on this aspect of Eclipse see Getting started with Eclipse.

  5. Create a new Java-project naming it "SOAPMQTutorial".

  6. Add all .jar files from the axis2 "lib" directory to the project's Build-Path.

  7. Right-click the "SOAPMQTutorial" project folder, select "Build Path", then "Add External Archives..."

  8. Add all the .jar files from your MQ lib directory e.g. ..\IBM\WebSphere MQ\java\lib

  9. Open a command prompt (aka "DOS box"), change to the "SOAPMQTutorial\src" directory and run the following command:

    wsdl2java -uri http://<yourserver>:<yourport>/world_dsn_city?WSDL -o ..\ -p SoaGW

  10. The following items are generated from the Portus WSDL:

    • A "Stub" class implementing all types and operations ( ports / bindings ).
    • A CallbackHandler - a stub class (not used in this tutorial) providing hooks for client-side extensions to the generated result- and error handlers.
    • A Fault class.

  11. Get file SOAPEntireXTut.java and, when prompted, save in the ..\SOAPMQTutorial\src\SoaGW directory. Right-click on SOAPMQTutorial and select Refresh(F5). SOAPMQTut.java should appear in the explorer window.

  12. Get file mqTransports-0.1.jar and, when prompted, save it in a local directory.

  13. Right-click on SOAPMQTutorial and select Build Path -> Add External Archives...

    Navigate to where mqTransports-0.1.jar was saved and select Open to add it the project.

  14. Right-click on SOAPMQTut.java and select Run As -> Java Application:

  15. The output appears in the "Console" window:


Ostia
www.ostiasolutions.com
Copyright @ 2006-2018 Ostia Software Solutions Limited.