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 September 7th, 2003, 12:34 PM
Registered User
 
Join Date: Sep 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reading XML datastream returned from vendor

I am sending the information from a form to a vendor site. There's a hidden field on the form that is loaded with the well-formed xml when the submit button is clicked. This is then passed to a vendor web site to get a quote. Their system reads this xml from the hidden field (via request.form) and passes pure xml code as the result (with a response.write). There is no other way to communicate with their system except to use their form handler since among other hidden fields are mandatory default fields that rae used to login etc.

My question is this ... how can I capture this XML returned from the form handler so that I can reformat it properly for display?. The returned XML shows up in my browser window but I can't seem to find a way to get to it.

When I use their url directly as the form handler (action=their url) I get the returned XML displayed in my browser ... If I try to replace their form handler with my own (see below)I get a blank page.

ANy help would be greatly appreciated.

I tried using setting the form action to an asp page. Within this asp page I grab all of the for elements and use the MSXML2.ServerXMLHTTP to send the request but it does not seem to be working.

content of the my asp form handler:

    for each sFormElement in Request.Form
         sDataToSend = sDataToSend & "&" & sFormElement & "=" & Server.HTMLEncode(Request.Form(sFormElement))
    next

    sDataToSend = Right(sDataToSend, Len(sDataToSend) - 1)

    strUrl = "https://www.vendor.com/xml/"
    strContentType = "application/x-www-form-urlencoded"

    set oXMLHttp = server.Createobject("MSXML2.ServerXMLHTTP")

    Call oXMLHttp.Open("POST", strURL, false)
    Call oXMLHttp.setRequestHeader("Content-Type", strContentType)
    Call oXMLHttp.Send(sDataToSend)


    set oResponseXMLDom = oXMLHttp.ResponseXML


Reply With Quote
  #2 (permalink)  
Old September 8th, 2003, 09:23 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

It sounds like the form is posting directly to their system. As you'll never be able to get control of the return XML. What you'll need to do is have the form post to your server, then you need to construct your own web request as a form post that your server will make to their server. Then your server will receive the response and process the returning XML as needed.

Look into the System.Net.HttpWebRequest class. I have only used this a little, but with it you should be able to construct a complete web request, building the form elements that you received from the user's form post, point it to their page, and a class method will return the response stream to you so you can grab the XML. It's going to turn your server into the browser from the viewpoint of your vendor's site.

Good luck,
Peter
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
Database Vendor Code: -1024 Dmitriy ASP.NET 2.0 Professional 5 January 15th, 2008 07:49 AM
Posting SOAP request to third party vendor finny.net .NET Web Services 4 January 24th, 2005 02:16 AM
Parsing xml datastream using XMLDOM realgone_ XML 8 September 23rd, 2004 08:50 AM
Reading XML datastream realgone_ Classic ASP XML 5 September 22nd, 2004 01:17 PM
Reading images straight from datastream shinmai PHP How-To 4 December 16th, 2003 04:21 PM



All times are GMT -4. The time now is 05:03 PM.


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