Link to home
Start Free TrialLog in
Avatar of Laride
Laride

asked on

Handling the response from the "Microsoft.XMLHTTP"

I have successfully set up a chunk of code using GET within  CreateObject("Microsoft.XMLHTTP") but am having problems dealing with the returned data.

I can use  reponse.txt   but this just gives me a text representation of the body. What I want to do is gather the full response and allocate it to variable names (or use the XML names - I don't mind) and display the data in a meaningful fashion within an ASP page. I notice the text command misses out empty fields completely; I would need this to come through as fields but empty - in the same way as is shown when the raw XML feed is displayed if you don't use the XMLHTTP object.

Can anybody help me?
Avatar of YZlat
YZlat
Flag of United States of America image

try using GetResponseStream:

Response.GetResponseStream

P.S What programming language are you using?
Avatar of Laride
Laride

ASKER

I'm using VBScript and old fashioned ASP. Isn't GetREsponseStream a .NET feature?

I don't do .NET - not yet anyway and certainly not for this project due to time constaints.
try setting response' content type


Response.ContentType = "text/xml"
dim objXMLHTTP
set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objXMLHTTP.Open "GET", sourceURL,false
objXMLHTTP.SetRequestHeader "Content-type", "text/xml"
objXMLHTTP.Send
Response.Write objXMLHTTP.ResponseText


Avatar of Laride

ASKER

That's pretty much exactly the code I have used so far. The response.Write XMLHTTP.reponse.Text gives me a long string which I don't actually want . I want to get the response back as neat little bundles of text to which i can assign a variable name to  each one and then display them individually in my web page.
Avatar of Laride

ASKER

Any further comments before I terminate the question with no points awarded?
Load the XMLTTP.response.Text property into an XmlDocument object, then you can traverse the XML however you want, outputting data how you want.

You could also use an XSLT to convert the response into what you want.
Avatar of Laride

ASKER

That sounds interesting OBonio. Sorry to be dense but how exactly would I do that?

ASKER CERTIFIED SOLUTION
Avatar of OBonio
OBonio
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial