Wrox Programmer Forums
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 7th, 2003, 12:34 PM
Registered User
Join Date: Sep 2003
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))

    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

Old September 8th, 2003, 09:23 AM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

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,

Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Vendor Code: -1024 Dmitriy ASP.NET 2.0 Professional 5 January 15th, 2008 08:49 AM
Posting SOAP request to third party vendor finny.net .NET Web Services 4 January 24th, 2005 03: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 05:21 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.