Sending an xml doc via cfhttp post

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Sending an xml doc via cfhttp post

    I am receiveing the following error when trying to send xml via cfhttp -

    Connection Failure: Status code unavailable

    The xml code works fine when posted from a html form. So I beleive the problem
    must lie with my use of cfhttp. Can anyone help?

    The code below sits in a process order cfm page.

    <cfset urlAddress="https://www.secure-epayments.apixml.hsbc.com:443">

    <cfxml variable = "XML">
    <XML>
    <EngineDocList>
    <DocVersion>1.0</DocVersion>
    <EngineDoc>
    <ContentType>OrderFormDoc</ContentType>

    <User>
    <Name>username</Name>
    <Password>password</Password>
    <ClientId DataType="S32">1234</ClientId>
    </User>

    <Instructions>
    <Pipeline>PaymentNoFraud</Pipeline>
    </Instructions>

    <OrderFormDoc>
    <Mode>Y</Mode>
    <Consumer>
    <PaymentMech>
    <CreditCard>
    <Number>4111111111111111</Number>
    <Expires DataType="ExpirationDate" Locale="826">01/07</Expires>
    </CreditCard>
    </PaymentMech>
    <BillTo>
    <Location>
    <TelVoice/>
    <Address>
    <Name>PTS Credit (New Transaction) Test</Name>
    <Street1>1 Dorset Court</Street1>
    <Street2/>
    <City>Northolt</City>
    <StateProv>Middlesex</StateProv>
    <PostalCode>UB54PZ</PostalCode>
    <Country>826</Country>
    </Address>
    </Location>
    </BillTo>
    </Consumer>

    <Transaction>
    <Type>PreAuth</Type>
    <CurrentTotals>
    <Totals>
    <Total DataType="Money" Currency="826">430</Total>
    </Totals>
    </CurrentTotals>
    </Transaction>
    </OrderFormDoc>
    </EngineDoc>
    </EngineDocList>

    </XML>
    </cfxml>

    <cfhttp url="#urladdress#" method="POST" throwOnError="Yes" charset="utf-8">
    <cfhttpparam type="XML" value="#xml#" name="CLRCMRC_XML">

    </cfhttp>

    Adrian Austin

    hoddle10 Guest

  2. Similar Questions and Discussions

    1. Trouble with CFHTTP Post XML to FedEx
      I am developing a ColdFusion application to request shipment information from FedEx. Their FSM Direct guidelines specify the format of the XML...
    2. How to post xml with cfhttp error?! HELP
      <cfhttp url = "http://10.1.6.211/ProposalGenerator.aspx" METHOD="POST" throwOnError = "yes" > <cfhttpparam name="propxml" TYPE="FORMFIELD"...
    3. Redirecting from Get to Post (maybe via CFHTTP??)
      Hey all, looking for some advice. Here is the situation... I have a website with links that go to a redirection script (to track clicks and...
    4. Sending POST-data
      I'm making a search-engine script for my site that redirects users to other search engines. Point is that on the website, there's a drop-down box...
    5. Sending data using the POST method.
      Hello, I am a beginner programmer and I am trying to do the following: I have a commercial script (catalog.php) which accepts variables using...
  3. #2

    Default Re: Sending an xml doc via cfhttp post

    You might try stripping the ":443" from the URL and instead add the PORT
    parameter to the CFHTTP call and set it to 443.

    Another option is to assign your entire xml to a string and pass the string as
    a FORMFIELD type instead of XML type:

    <cfset xml="
    <XML>
    <EngineDocList>
    <DocVersion>1.0</DocVersion>
    ...
    </XML>
    ">

    Using this simple cfset method will require you to double quote all your
    quotes but it's quick to try. Hope one of these suggestions works for you.


    Steve Sommers Guest

  4. #3

    Default Re: Sending an xml doc via cfhttp post

    Thanks for that Steve, much appreciated.

    Assigning the xml to a string and passing the string as a FORMFIELD did the trick.

    Adrian Austin

    hoddle10 Guest

  5. #4

    Default Re: Sending an xml doc via cfhttp post

    This is a good forum.

    I'm trying the double quotes and am running into a problem when running a
    cfloop in the xml.

    Invalid CFML construct found on line 155 at column 32:<cfloop
    query="RequestedDates">

    When I double quote the cfloop errors happen?

    I'm trying to send an xml document to another server but it seems that the
    cfxml document created via cfdump is not the XML format they understand.

    How do you publish a basic XML document without CFDump?

    I'm trying the double quotes below but am having some diffculity.

    Thanks



    <cfloop query="RequestedDates">
    <Rooms>
    <StayPatternDay roomType="" single"">
    <GuestroomData stayDayNumber="" #SingleRooms#"">
    </StayPatternDay>
    </Rooms>
    </cfloop>

    walkman Guest

  6. #5

    Default Re: Sending an xml doc via cfhttp post

    You cannot put anything more then CF variables and functions within a cfset
    instruction. You will need to create a temporary "rooms" variable and include
    this variable in your xml. Example:

    <cfset rooms="">
    <cfloop query="RequestedDates">
    <cfset rooms=rooms & "
    <Rooms>
    <StayPatternDay roomType="" single"">
    <GuestroomData stayDayNumber=""#SingleRooms#"">
    </StayPatternDay>
    </Rooms>
    ">
    </cfloop>

    <cfset xml="
    <XML>
    <EngineDocList>
    <DocVersion>1.0</DocVersion>
    ...
    #rooms#
    ...
    </XML>
    ">



    Steve Sommers Guest

  7. #6

    Default Re: Sending an xml doc via cfhttp post

    Thanks Steve for your help. It looped correctly.

    Walker
    walkman Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139