Albert Richer
Albert Richer

Reputation: 11

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

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>

Upvotes: 1

Views: 923

Answers (3)

Danny Armstrong
Danny Armstrong

Reputation: 1310

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.

Upvotes: 0

Dan Bracuk
Dan Bracuk

Reputation: 20804

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

Method 2 - Output your xml variables into a textarea.

Upvotes: 0

Miguel-F
Miguel-F

Reputation: 13548

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.

Upvotes: 3

Related Questions