12/6/17

Use Fiddler with BizTalk Adapters to view exchanged messages


To exchange information between Microsoft BizTalk Server and an application by means of the HTTP(S) protocol, in BizTalk we have many adapters like HTTP, SOAP, WCF adapters. When you send a message to the target application using HTTP(S) protocol, it’s always useful to see the content of message that’s being exchanged over the wire.

You can use many online tool to see the content of message, here i am using Fiddler in scenario for a while now. Fiddler is a free HTTP debugging proxy server application/tool, which captures the HTTP(s) traffic and logs the content for us to view.

First download and install fiddler if you dont have it.

In order to make fiddler intercept BizTalk messages:

You first need to identify which port fiddler listens to.

For this, go to Tools -> Fiddler Options -> Connections Tab




Default Port value is 8888.
Default Server Name is: 127.0.0.1

You can click on "Copy Browser Proxy Configuration URL" and paste in Internet explorer to see more details.




Next, Configure BizTalk Adapter. With server name and port details we can configure the BizTalk send ports.

In Static Send Port:
In BizTalk’s static send port which has been configured to use HTTP/SOAP/WCF adapter you have to set the proxy setting (Send port, adapter –> Configure –> Proxy).  Choose "Use Proxy" and give the proxy details as shown in below screen shots;

In Send Port with WCF-BasicHttp adapter:

In Send Port with HTTP/SOAP Adapter:



In Dynamic Send port:
For dynamic send port, the proxy details are resolved from the context of the outbound message. Hence you have to construct the outbound message context as follows below;

For WCF adapter:

msgOrder(WCF.ProxyAddress) = <a href="http://localhost:8888">http://localhost:8888</a>;
msgOrder(WCF.ProxyToUse)  = "UserSpecified";

For SOAP/HTT adapter (Change SOAP to HTTP based on adapter used):

msgOutboundRequest(SOAP.UseProxy) = true;
msgOutboundRequest(SOAP.ProxyAddress) = "locahost";
msgOutboundRequest(SOAP.ProxyPort) = "8888";

You don’t want to execute this code in production, so ensure these codes are executed only in debug mode.

Now with everything configured in BizTalk for fiddlers, you can start the Fiddler to trace the traffic. If you have configured BizTalk to use Fiddler, but if you have not started the Fiddler then your message would suspend with following error.

"Unable to connect to the remote server —> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8888"

So you have to make sure your Fiddler is started when BizTalk (which is configured to use proxy) sends the message.