Friday 6 June 2008

Fiddler helps with SOAP

When you want to inspect your SOAP traffic, you can use the http-debugging-proxy Fiddler to inspect your traffic. But right out of the box you cannot see the method called for each session. For this you can add a rule to the Rules.

Within the class declare the options you need:


// Show SOAP requests

public static RulesOption("Show SOAP Request", "SOAP")

var m_ShowSoapRequest: boolean = false;

Add this to the call OnBeforeResponse:


if (m_ShowSoapRequest) {

//oSession.utilDecodeRequest();

var strRequestStart : String = "><";

var iPos = oSession.utilFindInRequest(strRequestStart, false);

if (iPos != -1) {

var oBodyString : String = System.Text.Encoding.UTF8.GetString(oSession.requestBodyBytes);

iPos = iPos + strRequestStart.Length;

var iEndPos = oBodyString.IndexOf(">", iPos);

var soapRequest : String = oBodyString.Substring(iPos, iEndPos - iPos);

if (soapRequest.IndexOf("/") != -1) {
soapRequest = soapRequest.Substring(0, soapRequest.IndexOf("/"));

}

if (soapRequest.IndexOf(" ") != -1) {

soapRequest = soapRequest.Substring(0, soapRequest.IndexOf(" "));

}

oSession["ui-customcolumn"] = soapRequest;

}

}