Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / November 2006



Tip: Looking for answers? Try searching our database.

Reading a XML feed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kwillis - 29 Nov 2006 18:48 GMT
I need some help or example code.  I have CF MX 7.0.1 and i have been able to
send XML requests to vendors and accept and process their responses.  Now i
wish to do the same for my clients.  I am having trouble with setting up a
listener to transfer the stream to a structure i can manipulate.  Any help
would be great.  thanks.
Kevin Schmidt - 29 Nov 2006 19:28 GMT
Have them post the XML to page.

Then all you have to do is use the XMLParse function in ColdFusion and it will create an object you can manipulate.
kwillis - 29 Nov 2006 19:32 GMT
lets say i have them post to neworder.cfm.  what would the XMLParse function
syntax looklike to capture that stream?  thanks for your reply.  i have been
beating my head against the wall tring to get this to work.
MikerRoo - 29 Nov 2006 22:22 GMT
See the attached code to get started.

<!--- The client is required to POST XML to this page.
    Fetch it, process it, return an xml response.
--->
<CFSCRIPT>
    /*--- We are expecting an XML post.   This means that the entire request
body had
        better be valid XML.
    */
    zClientRequestDetails   = GetHttpRequestData ();
    sXML_PostString         = zClientRequestDetails.Content;
    zXML_PostDoc            = XmlParse (sXML_PostString);
</CFSCRIPT>

<!--- Now process the XML depending on your app. --->

<!--- Now output a simple reply XML. --->
<cfcontent  reset="Yes">

<CFOUTPUT><?xml version="1.0" encoding="UTF-8"?>
    <MyAPI>
        <statusCode>0</statusCode>
    </MyAPI>
</CFOUTPUT>

<!--- Make sure no "request end" footers corrupt our XML. --->
<CFABORT>
kwillis - 29 Nov 2006 22:54 GMT
Thank you sooooo much.  i feel like such an idiot now.  i was just having a
brain block.  i strated down a different path that ultimately got me lost.  i
was looking at old solutions (pre mx7) that confused me when trying to use the
more robust mx7.  again, thank you.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.