Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
hoddle10 #1
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
-
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... -
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"... -
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... -
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... -
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... -
Steve Sommers #2
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
-
hoddle10 #3
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
-
walkman #4
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
-
Steve Sommers #5
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
-
walkman #6
Re: Sending an xml doc via cfhttp post
Thanks Steve for your help. It looped correctly.
Walker
walkman Guest



Reply With Quote

