6 Replies Latest reply on May 14, 2014 1:45 AM by BKBK

    Coldfusion 10 problem with cfhttp postype xml

    damankwa

      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

        • 1. Re: Coldfusion 10 problem with cfhttp postype xml
          BKBK Adobe Community Professional & MVP

          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?

          • 2. Re: Coldfusion 10 problem with cfhttp postype xml
            damankwa Level 1

            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>

            • 3. Re: Coldfusion 10 problem with cfhttp postype xml
              BKBK Adobe Community Professional & MVP

              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);

                }

              }

              • 4. Re: Coldfusion 10 problem with cfhttp postype xml
                damankwa Level 1

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

                • 5. Re: Coldfusion 10 problem with cfhttp postype xml
                  damankwa Level 1

                  Issue solved.

                   

                  It was a  matter of changing this line

                   

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

                   

                  to use PROTOCOL="1"

                  • 6. Re: Coldfusion 10 problem with cfhttp postype xml
                    BKBK Adobe Community Professional & MVP

                    Glad to hear you solved it. Please mark the correct answer, as it will help someone else.