1

When using the cfhttp tag I am including the body + header through cfhttpparam's.

Because of the way Coldfusion is fusing together the XML before it's sent, I am getting syntax errors on the other end.

I need a temporary CFC that I can direct my call to for testing that will show me the exact XML I am sending.

How do I determine the exact XML that is being sent in the cfhttp request?

I have tried getHttpRequestData() but this method returns a structure and not the syntax I am looking for.


There's a similar thread to this question but doesn't address my specific need. View cfhttp request

<!--- Define Header --->
<cfsavecontent variable="soapHeader">
<cfoutput>
<soap:Header>
    <wsse:Security soap:mustUnderstand="1">
        <wsse:UsernameToken>
            <wsse:Username>MyUser</wsse:Username>
            <wsse:Password>MyPass</wsse:Password>
            <wsse:Nonce>fsdf568sf234k</wsse:Nonce> 
            <wsu:Created>2012-01-07T06:17:56Z</wsu:Created>
        </wsse:UsernameToken>
    <wsse:Security>
</soap:Header> 
</cfoutput>
</cfsavecontent>

<!--- Define Body --->
<cfsavecontent variable="soapBody">
<cfoutput>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">   
    <soap:Body>
        <EmpCpsVerifyConnection xmlns="https://www.vis-dhs.com/EmployerWebService/" />
    </soap:Body>
</soap:Envelope>
</cfoutput>
</cfsavecontent>

<!--- Make SOAP Request --->
<cfhttp 
method="post"
url="https://stage.e-verify.uscis.gov/WebService/EmployerWebServiceV24.asmx?wsdl"
result="httpResponse">

<cfhttpparam
 type="header"
 name="SOAPAction"
    value="https://www.vis-dhs.com/EmployerWebService/EmpCpsVerifyConnection"
    />
<cfhttpparam
 type="header"
 name="Security"
    value="#trim( soapHeader )#"
    /> 
<cfhttpparam
type="body"
    value="#trim( soapBody )#"
    />
</cfhttp>
Community
  • 1
  • 1

3 Answers3

3

You could use something like Fiddler or WireShark to examine the data stream. They are both free and EXTREMELY useful for debugging things like this.

Miguel-F
  • 13,450
  • 6
  • 38
  • 63
  • completely agree. Fiddler is essential for activities like this. You'll have to do a little fiddling with certificates in order to get CF to talk to Fiddler when working over HTTPS, but it's very worth it. As a workaround, set up the proxy and proxyport attributes on the cfhttp tag and change the URL to any non HTTPS URL, as you're only interested in seeing the exact request data. – barnyr Jan 07 '13 at 17:58
  • How do I "fiddle with certificates" to get Fiddler running with Coldfusion? I have looked around the ColdFusion administrator but can't find what needs to be done. – Albert Richer Jan 07 '13 at 19:50
  • Nothing to do with CF administrator. I believe what @barnyr was referring to is the need to import the Fiddler certificate into the Java certificate keystore since you are talking over SSL. See this about how Fiddler works with SSL [Decrypting HTTPS-protected traffic](http://www.fiddler2.com/Fiddler/help/httpsdecryption.asp) and this about importing certificates for ColdFusion [Import certificates - ColdFusion](http://helpx.adobe.com/coldfusion/kb/import-certificates-certificate-stores-coldfusion.html). Remember, after updating the certificate store you will need to restart ColdFusion. – Miguel-F Jan 07 '13 at 20:07
  • Side note: In order to install software like Fiddler or Wireshark, you need to have admin privileges to a PC on the network which the data is being sent or received. People using shared web hosting usually do not have admin access to their machine. – Russ Jan 08 '13 at 18:37
0

Method 1 - Output your xml variables to your web broswer. View the html source code.

Method 2 - Output your xml variables into a textarea.

Dan Bracuk
  • 20,699
  • 4
  • 26
  • 43
0

If you were invoking SOAP methods through the normal CF machinery you can enable full SOAP xml packet logging by editing the file {cf-root}/wwwroot/WEB-INF/client-config.wsdd.

Add or enable the following lines within the <globalConfiguration> element:

<requestFlow>
 <handler type="log"/>
</requestFlow>
<responseFlow>
 <handler type="log"/>
</responseFlow>

On my machine the logging ended up in {cf-root}/logs/cfserver.log.

Danny Armstrong
  • 1,320
  • 12
  • 13