For the SOAP/JMS interface, you can define an endpoint and binding programmatically directly from the application code.
About this task
To supply binding and endpoint information programmatically, add the required code to your application by completing the following steps.
Procedure
-
Create an instance of the transport binding element of the channel by adding the following code to your application:
SoapJmsIbmTransportBindingElement transportBindingElement = new SoapJmsIbmTransportBindingElement();
-
Set any required binding properties, for example, by adding the following code to your application to set the ClientConnectionMode:
transportBindingElement.ClientConnectionMode = XmsWCFBindingProperty.AS_URI;
-
Create a custom binding that pairs the transport channel with a message encoder by adding the following code to your application:
Binding binding = new CustomBinding(new TextMessageEncodingBindingElement(), transportBindingElement);
-
Create the SOAP/JMS URI.
The SOAP/
JMS URI that describes the
IBM® MQ connection details required to access the service, must be provided as the endpoint address. The address that you specify depends on whether the channel is being used for a service application or a client application.
- For client applications, the SOAP/JMS URI must be created as an
EndpointAddress as follows:
EndpointAddress address = new EndpointAddress("jms:/queue?destination=SampleQ@QM1&connectionFactory
=connectQueueManager(QM1)&initialContextFactory=com.ibm.mq.jms.Nojndi");
- For service applications, the SOAP/JMS URI must be created as a URI as follows:
Uri address = new Uri("jms:/queue?destination=SampleQ@QM1&connectionFactory=
connectQueueManager(QM1)&initialContextFactory=com.ibm.mq.jms.Nojndi");
For more information about endpoint addresses, see IBM MQ custom channel for WCF endpoint URI address format.