Debugging webservices with Charles

Debugging webservices can be tedious. You can save yourself quite a lot of time by using a network debugging proxy tool such as Charles.
Get it here and install it.
Open Charles and enable proxy. Set the proxy port to something like 8888

Charles proxy settings. Port 8888

Add proxyport and proxyserver attributes to your CFHTTP tag (I assume that you develop locally).

   <cfhttp url="" proxyport="8888" proxyserver="" name="returnXML" />

You are set. All webservice traffic is now going through Charles.
Let’s try to call a KirupaFX SOAP webservice, returning a list of top 10 movies of all times :) You can find the WSDL at

<!--- Define XML for SOAP call --->
<cfset requestXML = "<?xml version='1.0' encoding='utf-8'?><soap:Envelope xmlns:xsi='' xmlns:xsd='' xmlns:soap=''><soap:Body><ns1:GetTop10 xmlns:ns1='' /></soap:Body></soap:Envelope>" />
<!--- Set webservice URL --->
<cfset urlStr = "" />
<!--- Call the webservice. Note the proxyport and proxyserver attributes --->
<cfhttp url="#urlStr#" method="post" result="responseXML" compression="false" timeout="2" proxyport="8888" proxyserver="localhost">
	<cfhttpparam type="header" name="content-type" value="text/xml">
	<cfhttpparam type="header" name="content-length" value="#len(trim(requestXML))#">
	<cfhttpparam type="header" name="accept-encoding" value="no-compression" />
	<cfhttpparam type="header" name="charset" value="utf-8">
	<cfhttpparam type="header" name="Port" value="/GetTop10" />
	<cfhttpparam type="xml" value="#trim(requestXML)#" />
<!--- Process the results --->
<cfset moviesXML = XMLParse(responseXML.filecontent) /> 
<cfset moviesArr = moviesXML['soap:Envelope']['soap:Body']['GetTop10Response']['GetTop10Result'].XMLChildren /> 
<!--- Dump the array containing movie titles --->
<cfdump var="#moviesArr#" />

Load the page in your browser. Let’s check Charles:
Click the webservice call in the left pane to show the details:

Click ‘Contents->SOAP’ to review the details of all request/response elements

Click ‘Contents->XMLText’ to view raw XML

Click ‘Contents->XML’ to browser through XML nodes

Click ‘Contents->Headers’ to inspect http headers


  • Click Proxy->Recording settings->Include and add a hostname to limit your proxy recording session to one or more hosts
  • Click Proxy->Recording settings->Include and uncheck all hosts to view all server sessions