Skip to main content
Participant
May 9, 2014 4:36 PM UTC
Answered

Coldfusion 10 problem with cfhttp postype xml

We are making a cfhttp call.

We are submitting xml data. We are able to send information from server A to server B, but server B is not giving us any response.

Our code works for coldfusion 8 and 9 but it does not work for coldfusionh 10.

This is the snippet of the code

<cfhttp method="post" url="#httpURL#" timeout="3000" useragent="#CGI.http_user_agent#" >

    <cfhttpparam type="XML" value="#xmlRequest#" name="CLRCMRC_XML" >

</cfhttp>

The contents from server B can be access by

<cfdump var="#cfhttp.FileContent#">.

Note This works in coldfusion 8 and 9 but we are not getting any data from server B using coldfusion 10

This topic is closed to new replies. Start a new post to keep the conversation going.
damankwaCorrect answer
Participant
May 13, 2014 8:34 PM UTC

I solved the issue. The issue had something to do with a setting that returned via tcp/ip and not http.


Issue solved.

It was a  matter of changing this line

<REQUEST KEY="#companykey#" PROTOCOL="0" FMT="1" ENCODING="0">

to use PROTOCOL="1"

6 replies

BKBK
Community Expert
Community Expert
May 11, 2014 10:14 AM UTC

Could you show us the structure of the URL and how you create the variable xmlRequest?

Assuming server B is also on ColdFusion, is it using getHttpRequestData().content to access the XML contents?

Translate
damankwaAuthor
Participant
May 12, 2014 2:38 PM UTC

The url is an https call

Below is the xml data being sent to the other server.

<cfxml variable = "xmlRequest">
    <cfoutput><REQUEST KEY="#companykey#" PROTOCOL="0" FMT="1" ENCODING="0">
        <TRANSACTION>
            <FIELDS>
                <TERMINAL_ID>#terminalID#</TERMINAL_ID>   
                <SERVICE_FORMAT>1010</SERVICE_FORMAT>                            <!--- 1010 = Card not present (E-commerce) --->
                <CURRENCY_CODE>124</CURRENCY_CODE>                                 <!--- 124 = Canadian currency code, 840 = us code --->
                <CURRENCY_INDICATOR>0</CURRENCY_INDICATOR>                        <!--- 0 = currency will be processed as a domestic currency transaction --->
                <TRANSACTION_INDICATOR>7</TRANSACTION_INDICATOR>                <!--- 7 = account information was received through a secure internet site --->                   
                <SERVICE>CC</SERVICE>                                            <!--- CC = Credit Card Transaction--->
                <SERVICE_TYPE>DEBIT</SERVICE_TYPE>                                <!--- DEBIT = CHARGE CC ACCOUNT HOLDER--->
                <SERVICE_SUBTYPE>SALE</SERVICE_SUBTYPE>                            <!--- Authorize and move funds from account holder to merchant--->
                <GOODS_INDICATOR>P</GOODS_INDICATOR>                            <!--- P = physical goods, as opposed to electronic goods --->                                   
                <PIN></PIN>
                <OPERATOR>Amazingclu</OPERATOR>                                 <!--- operator/location responsible for the transaction generation, in this case, the website--->
                <AMOUNT>8</AMOUNT>
                <ENTRY_MODE>3</ENTRY_MODE>                                        <!--- 3 = data was manually entered, no card/check present --->                       
                <CVV></CVV>
                <EXPIRATION></EXPIRATION>
                <ACCOUNT_NUMBER></ACCOUNT_NUMBER>
                <FIRST_NAME></FIRST_NAME>
                <LAST_NAME></LAST_NAME>
                <ADDRESS></ADDRESS>
                <CITY></CITY>
                <STATE></STATE>
                <POSTAL_CODE></POSTAL_CODE>
                <PHONE></PHONE>
                <COUNTRY></COUNTRY>
                <USER_DATA_0></USER_DATA_0>                                        <!--- optional field allowing us to send arbitrary transaction data --->
            <!---    <VERBOSE_RESPONSE>1</VERBOSE_RESPONSE>                         for testing purposes only --->
            </FIELDS>
        </TRANSACTION>
    </REQUEST></cfoutput>
</cfxml>

Translate
BKBK
Community Expert
Community Expert
May 12, 2014 8:12 PM UTC

I used your XML to run the following test. The test page uses cfhttp to post the XML to a CFC. It works as expected, returning the XML.

testPage.cfm

<cfset companykey="myKey123">

<cfset terminalID="ID123">

<cfxml variable = "xmlRequest">

    <cfoutput><REQUEST KEY="#companykey#" PROTOCOL="0" FMT="1" ENCODING="0">

        <TRANSACTION>

            <FIELDS>

                <TERMINAL_ID>#terminalID#</TERMINAL_ID>

                <SERVICE_FORMAT>1010</SERVICE_FORMAT>                            <!--- 1010 = Card not present (E-commerce) --->

                <CURRENCY_CODE>124</CURRENCY_CODE>                                 <!--- 124 = Canadian currency code, 840 = us code --->

                <CURRENCY_INDICATOR>0</CURRENCY_INDICATOR>                        <!--- 0 = currency will be processed as a domestic currency transaction --->

                <TRANSACTION_INDICATOR>7</TRANSACTION_INDICATOR>                <!--- 7 = account information was received through a secure internet site --->

                <SERVICE>CC</SERVICE>                                            <!--- CC = Credit Card Transaction--->

                <SERVICE_TYPE>DEBIT</SERVICE_TYPE>                                <!--- DEBIT = CHARGE CC ACCOUNT HOLDER--->

                <SERVICE_SUBTYPE>SALE</SERVICE_SUBTYPE>                            <!--- Authorize and move funds from account holder to merchant--->

                <GOODS_INDICATOR>P</GOODS_INDICATOR>                            <!--- P = physical goods, as opposed to electronic goods --->

                <PIN></PIN>

                <OPERATOR>Amazingclu</OPERATOR>                                 <!--- operator/location responsible for the transaction generation, in this case, the website--->

                <AMOUNT>8</AMOUNT>

                <ENTRY_MODE>3</ENTRY_MODE>                                        <!--- 3 = data was manually entered, no card/check present --->

                <CVV></CVV>

                <EXPIRATION></EXPIRATION>

                <ACCOUNT_NUMBER></ACCOUNT_NUMBER>

                <FIRST_NAME></FIRST_NAME>

                <LAST_NAME></LAST_NAME>

                <ADDRESS></ADDRESS>

                <CITY></CITY>

                <STATE></STATE>

                <POSTAL_CODE></POSTAL_CODE>

                <PHONE></PHONE>

                <COUNTRY></COUNTRY>

                <USER_DATA_0></USER_DATA_0>                                        <!--- optional field allowing us to send arbitrary transaction data --->

            <!---    <VERBOSE_RESPONSE>1</VERBOSE_RESPONSE>                         for testing purposes only --->

            </FIELDS>

        </TRANSACTION>

    </REQUEST></cfoutput>

</cfxml>

<cfhttp url="http://127.0.0.1:8500/workspace/cfhttpTest/MyApp.cfc?method=echoXml" method="post">

<cfhttpparam type="xml" value="#xmlRequest#">

</cfhttp>

<cfdump var="#cfhttp.FileContent#">

MyApp.cfc

component {

remote string  function echoXml()

  {

     // the request data

    var xmlDoc = getHttpRequestData().content;

    return toString(xmlDoc);

  }

}

Translate