?
Solved

parsing xml and sending a response back

Posted on 2006-06-29
7
Medium Priority
?
261 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

764 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