Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP XML
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP XML Using ASP 3 and XML. See also the XML category for more XML discussions not relating to ASP. NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP XML section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 4th, 2010, 03:42 PM
Registered User
 
Join Date: Oct 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default asp form post and response xml

hi friends
im doing an xm hotel reservation b2c projects where im supposed to
send xml request to the main server and get response in return.
here is a the sample request

Quote:
<form action="http://www.servername.com/xml_req_parser.php" method="post">
<textarea name="xml" cols="90" rows="20">
<?xml version="1.0" encoding="UTF-8" ?>
<XMLRequest>
<RequestType>DestinationListRequest</RequestType>
<RequestLogin>
<AffiliateCode>AF0001</AffiliateCode>
<AffiliateUsername>myUserName</AffiliateUsername>
<AffiliatePassword>myPassword</AffiliatePassword>
<AffRequestId>5</AffRequestId>
<AffRequestTime><%=now()%></AffRequestTime>
</RequestLogin>
<DestinationListInfo>
<CompleteList>false</CompleteList>
</DestinationListInfo>
</XMLRequest>
</textarea><br>
<input type="submit">
</form>
in return i get the response from http://www.servername.com/xml_req_parser.php
which is the form target.

Quote:
<?xml version="1.0" encoding="UTF-8" ?>
<XMLResponse>
<ResponseType>HotelListResponse</ResponseType>
<RequestInfo>
<AffiliateCode>AF001</AffiliateCode>
<AffRequestId>5</AffRequestId>
<AffRequestTime>2010-09-30T14:43:24</AffRequestTime>
</RequestInfo>
<TotalNumber>51397</TotalNumber>
<Hotels>
<Hotel>
<HotelCode>ABCDE</HotelCode>
<DestinationId>NFUE</DestinationId>
<Destination>Nice</Destination>
<Country>France</Country>
<HotelName>One Spa Hotel</HotelName>
<StarRating>4</StarRating>
</Hotel>
<Hotel>
<--record 2 here-->
</Hotel>
<Hotel>
<--record 3 here-->
</Hotel>
<Hotel>
<--record 51397 here-->
</Hotel>
</Hotels>
</XMLResponse>
as the response is only after submiting a form how can i load the xml
into my asp program so that i can display the result in web page.
kindly help

neon

Last edited by neontwenty; October 5th, 2010 at 05:01 AM.
Reply With Quote
  #2 (permalink)  
Old October 4th, 2010, 09:25 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,652
Thanks: 3
Thanked 141 Times in 140 Posts
Default

See my answer here:
http://www.codingforums.com/showthread.php?t=206235
Reply With Quote
  #3 (permalink)  
Old October 5th, 2010, 04:54 AM
Registered User
 
Join Date: Oct 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

old pedant, thank you for the reply

it failed to load the xml, showing

XML load failed: XML document must have a top level element.

the xml actually having top level element in the response xml that i could see. i assume
it is not get loaded here.

below is the code i wrote

Quote:
<%
req=request.Form("xml") '// i changed the form ACTION to this page

Set httpObj = Server.CreateObject("msxml2.ServerXMLHTTP")
httpObj.Open "POST", "http://www.servername.com/xml_req_parser.php", False
httpObj.Send req



Set xmlObj = Server.CreateObject("Microsoft.XMLDOM")
'//xmlObj.Load httpObj.ResponseXML
xmlObj.Load httpObj.ResponseXML.xml


if xmlObj.parseError.reason <> "" then
Response.Write "XML load failed: " & xmlObj.parseError.reason & "<br>"
response.end
else
response.Write "load success"
end if

set rootObj=xmlObj.getElementsByTagName("Rooms")

response.Write rootObj.length
%>

Last edited by neontwenty; October 5th, 2010 at 05:02 AM.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
C# post xml using HttpWebRequest/Response datakix ASP.NET 1.0 and 1.1 Professional 4 July 20th, 2013 04:34 PM
How to post a XML file to a remote server and get a XML response back surendran ASP.NET 3.5 Professionals 2 January 29th, 2010 03:39 AM
POST response cached keenlearner BOOK: Professional Ajax ISBN: 978-0-471-77778-6 0 March 27th, 2007 04:12 PM
XML Post From VB to asp page LanceAtCti VB How-To 2 July 13th, 2006 09:58 AM
Reading an XML post in an ASP.NET web site spudgun2005 ASP.NET 1.0 and 1.1 Basics 0 November 3rd, 2005 05:40 PM



All times are GMT -4. The time now is 02:44 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.