Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Handling the response from the "Microsoft.XMLHTTP"

Posted on 2004-08-12
10
Medium Priority
?
235 Views
Last Modified: 2010-05-18
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?
0
Comment
Question by:Laride
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
10 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 11783242
try using GetResponseStream:

Response.GetResponseStream

P.S What programming language are you using?
0
 

Author Comment

by:Laride
ID: 11783568
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.
0
 
LVL 35

Expert Comment

by:YZlat
ID: 11787440
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


0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:Laride
ID: 11787921
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.
0
 

Author Comment

by:Laride
ID: 11818203
Any further comments before I terminate the question with no points awarded?
0
 
LVL 8

Expert Comment

by:OBonio
ID: 11820096
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.
0
 

Author Comment

by:Laride
ID: 11820219
That sounds interesting OBonio. Sorry to be dense but how exactly would I do that?

0
 
LVL 8

Accepted Solution

by:
OBonio earned 1000 total points
ID: 11825637
If the response is valid XML, then simply load it with :

Dim xmlDOM = Server.CreateObject("MSXML.DOMDocument")

xmlDOM.LoadXML(XMLHTTP.Response.Text)

or you could just

xmlDOM.Load("http://myurl/")

Then it's just a case of recursing through the XML nodes outputting what you want :

Take a look here to discover more about the wonders of XML :

http://www.perfectxml.com/msxmlDOM.asp

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question