I am trying to effectively do the reverse of a CFHTTP post of an xml file. I am working on collaboration with another company and we need to send xml documents to and from each other. I can post my xml files to them happily using the CFHTTP command and happily receive a response back.
What I need to do is allow them to do the same (send files to me and me give a response) using what ever language they are using. I need to receive their xml file, process it and send back a response.
I have tried all sorts of combinations cfhttp but to no avail, I have looked on this listing again with no luck. I am using CF5 on win2K and an SQL system.
If anyone can help, it really would be appreciated.
Thanks
Lee
<!--- Get requestdata in a struct --->
<cfset xml = GetHttpRequestData()>
<!--- Transfer struct content to a string --->
<cfset xmltest = ToString( xml.content )>
<!--- Parse string into an XML document object --->
<cfset myXMLDocument = XmlParse( xmltest )>
trygve
Thanks for the reply, but not sure how this works, I have looked at the GetHttpRequestData() function in CF Studio and have looked at the sample code. I have attached my post page below and then the page to which is submits using the code from the example which I would have thought would have returned a structure to the CFHTTP.filecontent variable but to now avail.
I know I am being dim somewhere but not sure where.
Regards,
Lee
### INPUT PAGE ###
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<cfset test_var = "test data">
<cfhttp url="http://dev.sportfocus.com/reguser/DynaBizInfo/LF_mobile_test.cfm" method="POST">
<cfhttpparam name="Data" value="#test_var#" type="FORMFIELD">
</cfhttp>
<cfoutput>#cfhttp.filecontent#</cfoutput>
</body>
</html>
### RECEIVING PAGE ###
<cfset x = GetHttpRequestData()>
<cfoutput>
<table cellpadding = "2" cellspacing = "2">
<tr>
<TD><b>HTTP Request item</b></td>
<td><b>Value</b></td>
</tr>
<cfloop collection = #x.headers# item = "http_item">
<tr>
<td>#http_item#</td>
<td>#StructFind(x.headers, http_item)#</td>
</tr>
</cfloop>
<tr>
<td>request_method</td>
<td>#x.method#</td>
</tr>
<tr>
<td>server_protocol</td>
<td>#x.protocol#</td>
</tr>
</table>
<b>http_content --- #x.content#</b>
</cfoutput>
If their page is posting a form with XML in it like this:
<form action="yourCFMpage.cfm" method="post">
<input type="text" name="foo" value="----XML HERE ----">
</form>
A simple version of your page will look like this:
<cfparam name="form.foo">
<cfset xmlFoo = xmlParse(form.foo)>
<!---- Code here to process XML --->
<!--- put code here to output reply, this would be returned in the http request they made --->
Hope this helps
-m
Realised what the problem was. I was using cfhttp effectively to test a file on the same server which was throwing an error. As soon as I put the submitting page on another server it pulled back the correct information. Thanks for your help. I can now move on with my project.
Regards,
Lee