Quantcast
Channel: Adobe Community : Unanswered Discussions - ColdFusion
Viewing all articles
Browse latest Browse all 5794

Problems with ColdFusion11 and Cybersource SOAP

$
0
0

I'm having a great deal of trouble trying to implement a SOAP call to CyberSource, and I'd appreciate any help that anyone can provide.

 

The environment: ColdFusion 11 on Windows 2012 Server, 64-bit.

 

The SOAP packet (personal info redacted) is as follows; it's basically the CyberSource sample provided in their documentation:

 

<?xml version="1.0" encoding="utf-8"?>

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

     xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/"

     xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

    <soapenv:Header>

    <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">

    <wsse:UsernameToken>

    <wsse:Username>XXXXXXX</wsse:Username>

    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0##Passwo rdText">XXXXXXX</wsse:Password>

    </wsse:UsernameToken>

    </wsse:Security>

    </soapenv:Header>

    <soapenv:Body>

        <requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.126">

        <merchantID>XXXXXXX</merchantID>

        <merchantReferenceCode>XXXXXXX</merchantReferenceCode>

        <billTo>

            <firstName>XXXXXXX</firstName>

            <lastName>XXXXXXX</lastName>

            <street1>XXXXXXX</street1>

            <street2></street2>

            <city>XXXXXXX</city>

            <state>XX</state>

            <postalCode>XXXXXXX</postalCode>

            <country>XX</country>

            <phoneNumber>000 000 0000</phoneNumber>

            <email>null@cybersource.com</email>

        </billTo>

        <item id="0">

            <unitPrice>65.00</unitPrice>

            <quantity>1</quantity>

        </item>

        <purchaseTotals>

            <currency>USD</currency>

        </purchaseTotals>

        <card>

            <accountNumber>4111111111111111</accountNumber>

            <cvNumber>000</cvNumber>

            <expirationMonth>10</expirationMonth>

            <expirationYear>2018</expirationYear>

        </card>

        <ccAuthService run="true"/>

        </requestMessage>

    </soapenv:Body>

</soapenv:Envelope>

 

The transmission is as follows:

 

<cfhttp url="https://ics2wstesta.ic3.com/commerce/1.x/transactionProcessor" method="post" port="443" resolveurl="false" result="httpResponse">

<cfhttpparam type="header" name="content-type" value="text/xml; charset=utf-8"/>

<cfhttpparam type="header" name="accept-encoding" value="no-compression"/>

<cfhttpparam type="header" name="content-length" value="#Len(Trim(variables.soap_packet))#"/>

<cfhttpparam type="xml" value="#Trim(variables.soap_packet)#"/>

</cfhttp>

 

The response from CyberSource is:

 

<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <soap:Fault xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/04/secext" xmlns:c="urn:schemas-cybersource-com:transaction-data-1.0"> <faultcode>soap:Client</faultcode> <faultstring> XML parse error. </faultstring> </soap:Fault> </soap:Body> </soap:Envelope>

 

There are two interesting things going on.

 

1. Initially, I built the SOAP packet by enclosing the above item like this:

 

    <cfsavecontent var="soap_packet"><cfoutput>.....</cfoutput></cfsavecontent>.

 

When I tested the resulting string via #IsXML(Trim(XMLFormat(variables.soap_packet)))#, I got "NO".

 

Then I built the packet by enclosing the above item like this:

 

    <cfxml variable="soap_xml"><cfoutput>.....</cfoutput></cfxml>,

 

which produces a SOAP document object. I then converted that document object to a string via

 

    <cfset soap_packet = #ToString(variables.soap_xml)#>

   

Testing the result via #IsXML(Trim(variables.soap_packet))#, I got "YES", and that's what I'm passing in the transmission.

 

So there's the first issue: Why is ColdFusion apparently producing different results for the two approaches?

 

2. Assuming I'm passing well-formed and valid XML with the second approach, why is the interaction with CyberSource failing?

 

As I've said, this is becoming very frustrating. Can anyone tell me what I'm doing wrong?


Viewing all articles
Browse latest Browse all 5794

Trending Articles