Invoking Tcp-Hosted Web Services using the WSE 3.0 adapter for BizTalk Server

One of my favorite’s features of the WSE 3.0 adapter is the capabilities to invoke Web Services that uses non-HTTP transports. That’s a feature that a lot of people, including myself, were expecting on the WSE 2.0 adapter for BTS 2004.

Now with on this version we are able to invoke Web Services hosted using transports like Tcp, MSMQ, etc. We can also expose orchestration as host-independent ASMX services and how those services in an application that uses a different transport.

 

Let’s run through a simple demo.

Suppose that we have the following WSE 3.0 Web Services hosted in a Console application using TCP-IP as transport.

 

public class UtilWebService: SoapService

    {

        [SoapMethod("Echo")]

        public string Echo(string msg)

        {

            Console.WriteLine("Request received: message=" + msg);

            return "Message received: " + msg;

        }

    }

Figure 1: WSE Service code

 

The Web Services host looks like the following:

 

static void Main (string[] args)

        {

            UtilWebService service = new UtilWebService();

            Console.WriteLine("Soap Tcp Service...");

            Uri to = new Uri("soap.tcp://tc2003s:8089/MathWS");

            EndpointReference EPR = new EndpointReference(to);

            SoapReceivers.Add(EPR, service);

            Console.ReadLine();

 

        }

Figure 2: WSE Service Tcp host

 

The WSE Schema Generator wizard is able to query a TCP endpoint using WS-MetaDataExchange (I blogged about this technique a while ago) to obtain the Web Service WSDL.

 

 

 

Figure 3: Importing schemas

 

The next required step is to configure the WSE 3.0 send port at deployment time. As part of the Send Port properties we can specify a soap:tcp address.

 

 

Figure 4: Send Port properties.

 

With that configuration the WSE 3 adapter will send the following Soap request to the WSE Service.

 

<soap:Envelope xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<soap:Header>

  <wsa:Action>Echo</wsa:Action>

  <wsa:MessageID>urn:uuid:498d2ea0-d65b-465a-b779-939fa0bd0bc7</wsa:MessageID>

<wsa:ReplyTo> <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>

  </wsa:ReplyTo>

  <wsa:To>soap.tcp://tc2003s:8089/MathWS</wsa:To>

  </soap:Header>

<soap:Body>

  <ns0:string xmlns:ns0="http://tempuri.org/">string_0</ns0:string>

  </soap:Body>

  </soap:Envelope>

 

Figure 5: Soap Request

4 Comments

  • Where can I find the BizTalk Adapter for WSE 3.0 Schema Generation Wizard; I've installed the adapter but can't seem to find this wizard.

    Thanks

  • Where can I find the BizTalk Adapter for WSE 3.0 Schema Generation Wizard; I've installed the adapter but can't seem to find this wizard.

    venkateswara
    Thanks

  • Hi, I have web service which uses soap.tcp protocol. How can I connect to it from client created in unmanaged VC++?

    Thankx.

  • The Messaging Engine failed to create the transport adapter "TCP".
    OutboundAssemblyPath: ...
    OutboundTypeName: "Microsoft.Samples.BizTalk.Adapter.Tcp.Send.SendAdapter"
    Exception Details: "The type initializer for 'Microsoft.Samples.BizTalk.Adapter.Tcp.Send.SendAdapter' threw an exception."

    Any thoughts as to what might be causing this error.

Comments have been disabled for this content.