Message Tracing in BizTalk Web Service Proxies

I blogged about the message tracing feature in WSE yesterday, but WSE isn’t the only recent Microsoft product with a built-in tracing feature.

 

If you look at the code generated by the BizTalk Web Services Publishing Wizard you might notice a couple of things:

 

  • Two commented out SoapExtensions LINK in the web.config file.
    <webServices>

         <soapExtensionTypes>

           <!-- add type="$SoapExtensionType.FullName$, $AssemblyName.Name$"

             priority="1" group="0" /-->

      </soapExtensionTypes>

      <soapExtensionReflectorTypes>

        <!-- add type="$SoapExtensionReflectorTypes.FullName$, $AssemblyName.Name$" /-->

      </soapExtensionReflectorTypes>

     </webServices>

  • Two C# source code files, TraceExtension.cs and WsdlExtension.cs. Those files house the source code for the SoapExtension and the SoapExtensionReflector to be referenced in the web.config file. Yet neither one of these files is part of the BizTalk Web Service Proxy project by default.

 

 

The SoapExtensionReflector allows customization of the WSDL document returned by the proxy Web service. The SoapExtension allows you to trace messages processed by the Web service proxy. Enabling tracing at the web service layer helps end-to-end troubleshooting of orchestrations exposed via web services, since the BizTalk message tracing only captures messages that are actually processed by a BizTalk receiver location. If for some reason the proxy cannot send the SOAP message to the receiver location, then addind tracing to the proxy is a great troubleshooting help.

 

To enable message tracing for the Web service proxy, you have to add the TraceExtension.cs file to the Visual Studio solution and build it. Then you have to activate the SOAP trace extension in the web.config file. Uncomment the <add> element and specify FullName and the assembly name of the TraceExtension to have the ASP.NET Web services plumbing to load the SoapExtension in the SOAP processing pipeline.

 

<soapExtensionTypes>

  <add type="Orchestration_Proxy.TraceExtension, Orchestration_Proxy" priority="1" group="0" />

</soapExtensionTypes>

 

Now you can deploy the generated assembly and the updated web.config file to the ASP.NET web service and all SOAP requests and responses are written to a tracing file. By default, this tracing file lives in the <Temp Directory>/BizTalkWebServices<AssemblyName>_<AssemblyVersion>, but you can customize the location by adding a [<ProjectProjectNamespace>.TraceExtension] attribute to the [WebMethods] of the proxy service.

 

[WebMethod]

[TraceExtension(Pathname=”C:\\MyTraceDir\”]

public void DoStuff()

{

// …

}

 

One final thing to keep in mind for the tracing extensions is performance. The code for these proxies is not intended for high-throughput scenarios. You should only take this approach during development or in debugging activities in isolated environments to. For everything else, you should stick to the message tracking features in Biztalk.

2 Comments

Comments have been disabled for this content.