WCF client to an Axis Java service hosted by IBM MQ sample

Sample client applications and sample service proxy applications are supplied for both Java and .NET. The samples are based on a Stock Quote service that takes a request for a stock quote and then provides the stock quote.

Before you begin

This sample requires that the .NET SOAP over JMS service hosting environment is correctly installed and configured in IBM® MQ and is accessible from a local queue manager. For information about installing and configuring the environment, see: Installing IBM MQ Web transport for SOAP

When the .NET SOAP over JMS service hosting environment is correctly installed and configured in IBM MQ and is accessible from a local queue manager, additional configuration steps must be completed.

  1. Set the WMQSOAP_HOME environment variable to the IBM MQ installation directory, for example: C:\Program Files\IBM\MQ
  2. Ensure that the Java compiler javac is available and on the PATH.
  3. Copy the file axis.jar from the prereqs/axis directory of the WebSphere® installation CD to the IBM MQ installation directory.
  4. Add to the PATH: MQ_INSTALLATION_PATH\Java\lib where MQ_INSTALLATION_PATH represents the directory where IBM MQ is installed, for example: C:\Program Files\IBM\MQ
  5. Ensure that the location of .NET is specified correctly in MQ_INSTALLATION_PATH\bin\amqwcallWSDL.cmd where MQ_INSTALLATION_PATH represents the directory where IBM MQ is installed, for example: C:\Program Files\IBM\MQ. The location of .NET can be specified for example: set msfwdir=%ProgramFiles%\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin
When the previous steps are complete, test and run the service:
  1. Navigate to your SOAP over JMS working directory.
  2. Enter one of the following commands to run the verification test and leave the service listener running:
    • For .NET: MQ_INSTALLATION_PATH\Tools\soap\samples\runivt dotnet hold where MQ_INSTALLATION_PATH represents the directory where IBM MQ is installed.
    • For AXIS: MQ_INSTALLATION_PATH\Tools\soap\samples\runivt Dotnet2AxisClient hold where MQ_INSTALLATION_PATH represents the directory where IBM MQ is installed.
The hold argument keeps the listeners running after the test completes.
If errors are reported during this configuration, you can remove all the changes so that the procedure is restarted in the following way:
  1. Delete the generated SOAP over JMS directory.
  2. Delete the queue manager.

About this task

The sample demonstrates a connection from a WCF client to the Axis Java SOAP over JMS sample service provided in IBM MQ using a one-way channel shape. The service implements a simple StockQuote example, which outputs a text string to a file which is saved in the current directory.

The client has been generated by using WSDL to generate client files as described in Generating a WCF client proxy and application configuration files using the svcutil tool with WSDL

The sample has been configured with specific resource names as described in this paragraph. If you need to change the resource names, then you must also change the corresponding value on the client application in the MQ_INSTALLATION_PATH \tools\wcf\samples\WMQAxis\default\client\app.config file, and on the service application in the MQ_INSTALLATION_PATH \tools\wcf\samples\WMQAxis\default\service\WmqDefaultSample_StockQuoteDotNet.wsdl file, where MQ_INSTALLATION_PATH represents the installation directory for IBM MQ.

Procedure

Run the client once: Run the MQ_INSTALLATION_PATH \tools\wcf\samples\WMQAxis\default\client\bin\Release\TestClient.exe file, where MQ_INSTALLATION_PATH represents the installation directory for IBM MQ.
The client application loops five times sending five messages to the sample queue.

Results

The service application gets the messages from the sample queue and adds Hello World five times to a file in the current directory.