Defining binding and endpoint information programmatically: Non-SOAP/Non-JMS interface

For the Non-SOAP/Non-JMS interface, we can define an endpoint and binding programmatically directly from the application code.


To supply binding and endpoint information programmatically, add the required code to the application by completing the following steps.


Procedure

  1. Create a WmqBinding by adding the following code to the application:
    WmqBinding binding = new WmqBinding();
    
    This code creates a binding that pairs the WmqMsgEncodingElement and WmqIbmTransportBindingElement required for the Non-SOAP/Non-JMS interface.
  2. Provide the wmq:// URI that describes the IBM MQ connection details required to access the service. The way in which you provide the wmq:// URI depends on whether the channel is being used for a service application or a client application.

    • For client applications, the wmq:// URI must be created as an EndpointAddress as follows:
      EndpointAddress address = new EndpointAddress
      ("wmq://localhost:1414/msg/queue/Q1?connectQueueManager=QM1&replyTo=Q2");
      
    • For service applications, the wmq:// URI must be created as a URI as follows:
      Uri sampleAddress = new Uri(
      "wmq://localhost:1414/msg/queue/Q1?connectQueueManager=QM1&replyTo=Q2");
      

Parent topic: Create a WCF custom channel by suppling binding and endpoint information programmatically