Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

parsing xml and sending a response back

Posted on 2006-06-29
7
Medium Priority
?
264 Views
Last Modified: 2013-12-24
another server is sending our server xml. for now i just want to find out how to receive that xml and send a response back saying "i got it" by sending back this line.

<?xml version="1.0" encoding="iso-8859-1"?><status><result>success</result></status>

so using the following code to try and do that, i am getting a "The system cannot locate the resource specified" error on the last line (i.e <cfset xmlHTTP.send(xmlDoc2)>)

any idea why it can't find it?


<!-- RETRIEVE XML FROM OTHER SERVER -->
<cfset xml = url.xmlToPass>

<cfobject name="xmlDoc" class="msxml.domDocument" action="create" type="COM">

<cfset xmlDoc.async="False">

<cfset xmlDoc.loadXML(xml)>

<cfset ParseErr = xmlDoc.parseError>

<cfoutput><b>#ParseErr.errorCode#</b><br /><b>#ParseErr.reason#</b></cfoutput>


<!-- SEND XML RESONSE BACK TO OTHER SERVER -->

<cfset xml2="<?xml version='1.0' encoding='iso-8859-1'?><status><result>success</result></status>">

<cfobject name="xmlDoc2" class="msxml.domDocument" action="create" type="COM">

<cfset xmlDoc2.async="False">

<cfset xmlDoc2.loadXML(xml2)>

<cfset ParseErr2 = xmlDoc2.parseError>
<cfoutput><b>#ParseErr2.errorCode#</b><br /><b>#ParseErr2.reason#</b></cfoutput>

<cfobject name="xmlHTTP" class="Microsoft.XMLHTTP" action="create" type="COM">


<cfset xmlHTTP.open("POST", "http://#CGI.SERVER_NAME##CGI.SCRIPT_NAME#?#CGI.QUERY_STRING#", false)>
 
<cfset xmlHTTP.setRequestHeader("Method","POST")>
<cfset xmlHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded")>
<cfset xmlHTTP.setRequestHeader("Content-Length", 180)>
<cfset xmlHTTP.setRequestHeader("Version","HTTP/1.0")>

     
<cfset xmlHTTP.send(xmlDoc2)>
0
Comment
Question by:Judy Deo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
7 Comments
 

Author Comment

by:Judy Deo
ID: 17013293
oh we are still on cold fusion server 4.5...
0
 

Author Comment

by:Judy Deo
ID: 17019035
anybody? :)
0
 

Author Comment

by:Judy Deo
ID: 17019307
i found the following code, would this work? i'm a bit confused about the last line, shouldn't it be -> xmlhttp.Send(xml)



<script language="JavaScript1.2">
<!--
function sendXMLResponse()
{ var xml = "<?xml version='1.0' encoding='iso-8859-1'?><status><result>success</result></status>"
 var blah = new ActiveXObject("msxml.domDocument")
 blah.loadXML(xml)
 var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
 xmlhttp.Open("POST", "https://www.website.com", false)
 xmlhttp.setRequestHeader("Method","POST")
 xmlhttp.setRequestHeader("Content-Length", 180)
 xmlhttp.setRequestHeader("Version","HTTP/1.0")
 xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
 xmlhttp.Send("<some>asdf</some>")
}
//-->
</script>
0
Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

 
LVL 3

Accepted Solution

by:
cyrk earned 2000 total points
ID: 17022348
I don't really understand what you are doing after the first cfobject..why do you need that?

I'm not really sure, but worth a try..

<cfset xml2="<?xml version='1.0' encoding='iso-8859-1'?><status><result>success</result></status>">
<cfobject name="xmlDoc2" class="msxml2.ServerXMLHTTP.3.0" action="create" type="COM">

<cfset xmlDoc2.open("POST", "http://#CGI.SERVER_NAME##CGI.SCRIPT_NAME#?#CGI.QUERY_STRING#", false)>
 
<cfset xmlDoc2.setRequestHeader("Method","POST")>
<cfset xmlDoc2.setRequestHeader("Content-Type","application/x-www-form-urlencoded")>
<cfset xmlDoc2.setRequestHeader("Content-Length", 180)>
<cfset xmlDoc2.setRequestHeader("Version","HTTP/1.0")>

<cfset xmlDoc2.send(xml2)>
0
 

Author Comment

by:Judy Deo
ID: 17033869
>>I don't really understand what you are doing after the first cfobject..why do you need that?

I am trying to send a xml response back to that other sever..

specifically, i am trying to send back:

<?xml version='1.0' encoding='iso-8859-1'?><status><result>success</result></status>

is there a better way to do this?

the part that says:

#CGI.SERVER_NAME##CGI.SCRIPT_NAME#?#CGI.QUERY_STRING#"

is suppose to the url of that other server..
0
 

Author Comment

by:Judy Deo
ID: 17100758
decided to just use the following:

http://www.activsoftware.com/xml/xmlparser/
0
 

Author Comment

by:Judy Deo
ID: 17100768
our server shows that it support php so maybe i'll have the response sent back using php.
0

Featured Post

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
What You Need to Know when Searching for a Webhost Provider
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question