IBM WebSphere MQ transport for SOAP Web service clients

You can reuse an existing SOAP over HTTP client with IBM® WebSphere® MQ transport for SOAP. You must make some small modifications to the code and build process to convert the client to work with IBM WebSphere MQ transport for SOAP.

Coding

JAX-RPC clients must be written in Java. .NET Framework 1 and 2 clients can be written in any language that uses the Common Language Runtime. Code examples are provided in C# and Visual Basic.

The level of transactional support depends on the client environment and the pattern of the SOAP interaction. The SOAP request and SOAP reply can not be part of the same atomic transaction.

You must call IBM.WMQSOAP.Register.Extension() in a .NET Framework 1, .NET Framework 2 client. In a JAX-RPC Java Web service client call com.ibm.mq.soap.Register.extension to register the WebSphere MQ SOAP sender. The method registers the WebSphere MQ transport for SOAP sender as the handler for SOAP messages using the jms: protocol.

To create a .NET Framework 3 client, generate a Windows Communication Foundation client proxy using the svcutil tool; see Generating a WCF client proxy and application configuration files using the svcutil tool with metadata from a running service.

Libraries required to build and run .NET Framework 1 and 2 clients

  • amqsoap
  • System
  • System.Web.Services
  • System.Xml

Libraries required to build and run Axis 1.4 clients

  • MQ_Install\java\lib\com.ibm.mq.soap.jar;
  • MQ_Install\java\lib\com.ibm.mq.commonservices.jar;
  • MQ_Install\java\lib\soap\axis.jar;
  • MQ_Install\java\lib\soap\jaxrpc.jar
  • MQ_Install\java\lib\soap\saaj.jar;
  • MQ_Install\java\lib\soap\commons-logging-1.0.4.jar;
  • MQ_Install\java\lib\soap\commons-discovery-0.2.jar;
  • MQ_Install\java\lib\soap\wsdl4j-1.5.1.jar;
  • MQ_Install\java\jre\lib\xml.jar;
  • MQ_Install\java\lib\soap\servlet.jar;
  • MQ_Install\java\lib\com.ibm.mq.jar;
  • MQ_Install\java\lib\com.ibm.mq.headers.jar;
  • MQ_Install\java\lib\com.ibm.mq.pcf.jar;
  • MQ_Install\java\lib\com.ibm.mq.jmqi.jar;
  • MQ_Install\java\lib\com.ibm.mq.jmqi.remote.jar;
  • MQ_Install\java\lib\com.ibm.mq.jmqi.local.jar;
  • MQ_Install\java\lib\connector.jar;
  • MQ_Install\java\lib\jta.jar;
  • MQ_Install\java\lib\jndi.jar;
  • MQ_Install\java\lib\ldap.jar

Register SOAP extension

Read syntax diagramSkip visual syntax diagramJavaC#Visual Basic
Java
Read syntax diagramSkip visual syntax diagramcom.ibm.mq.soap.Register.extension()
C#
Read syntax diagramSkip visual syntax diagramIBM.WMQSOAP.Register.Extension();
Visual Basic
Read syntax diagramSkip visual syntax diagramIBM.WMQSOAP.Register.Extension

Client examples

Figure 1 is an example of a .NET Framework 1 or .NET Framework 2 C# client that uses the inline programming model. The IBM.WMQSOAP.Register.Extension() method registers the WebSphere MQ SOAP sender with .NET as the jms: protocol handler.

Figure 1. C# Web service client sample
using System;
namespace QuoteClientProgram {
    class QuoteMain {
        static void Main(string[] args) {
            try {
                IBM.WMQSOAP.Register.Extension();
                Quote q = new Quote();
                Console.WriteLine("Response is: " + q.getQuote("ibm"));
             }  catch (Exception e) {
                Console.WriteLine("Exception is: " + e);
             }
        }
    }
}
Figure 2 is an example of a Java client that uses the JAX-RPC static proxy client interface. The com.ibm.mq.soap.Register.extension(); method registers the WebSphere MQ SOAP sender with the service proxy to handle the jms: protocol.
Figure 2. Java Web service client example
package org.example.www;
import com.ibm.mq.soap.Register;
public class QuoteClient {
   public static void main(String[] args) {
      try {
         Register.extension();
         QuoteSOAPImplServiceLocator locator = new QuoteSOAPImplServiceLocator();
         System.out.println("Response = " 
                  + locator.getOrgExampleWwwQuoteSOAPImpl_Wmq().getQuote("IBM"));
      } catch (Exception e) {
         System.out.println("Exception = " + e.getMessage());
      }
   }
}