Simple one-way client and server WCF sample

This sample demonstrates the IBM MQ custom channel being used to start a Windows Communication foundation (WCF) service from a WCF client using a one-way channel shape.


The service implements a single method which outputs a string to the console. The client has been generated by using the svcutil tool to retrieve the service metadata from a separately exposed HTTP endpoint as described in Generating a WCF client proxy and application configuration files using the svcutil tool with metadata from a running service

The sample has been configured with specific resource names as described in the following procedure. If we must change the resource names, then we must also change the corresponding value on the client application in the MQ_INSTALLATION_PATH \tools\dotnet\samples\cs\wcf\samples\WCF\oneway\client\app.config file, and on the service application in the MQ_INSTALLATION_PATH \tools\dotnet\samples\cs\wcf\samples\WCF\oneway\service\TestServices.cs file, where MQ_INSTALLATION_PATH is the installation directory for IBM MQ. For more information about formatting the JMS endpoint URI, see IBM MQ Transport for SOAP in the IBM MQ product documentation. For to modify the sample solution and source, then we need an IDE, for example, Microsoft Visual Studio 8 or higher.


Procedure

  1. Create a queue manager called QM1
  2. Create a queue destination called SampleQ
  3. Start the service so the listener is waiting for messages: Run the MQ_INSTALLATION_PATH \tools\dotnet\samples\cs\wcf\samples\WCF\oneway\service\bin\Release\TestService.exe file, where MQ_INSTALLATION_PATH is the installation directory for IBM MQ.
  4. Run the client once: Run the MQ_INSTALLATION_PATH \tools\dotnet\samples\cs\wcf\samples\WCF\oneway\client\bin\Release\TestClient.exe file, where MQ_INSTALLATION_PATH is the installation directory for IBM MQ. The client application loops five times sending five messages to SampleQ


Results

The service application gets the messages from SampleQ and displays Hello World on the screen five times.


What to do next

Parent topic: Use the WCF samples