Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retriving XML-format data from web service with classic asp

Status
Not open for further replies.

furtivevole

Technical User
Jun 21, 2001
84
GB
Hi Using classic asp, I'm trying to retrieve a string including xml tags from an intranet web server:
Code:
<%
Function GetHTML(strURL)
	
	Dim objXMLHTTP, strReturn
	Set objXMLHTTP =  Server.CreateObject("Msxml2.ServerXMLHTTP.3.0")
    objXMLHTTP.Open "GET", strURL, false	
	objXMLHTTP.Send 
	Response.ContentType = "text/xml"	
	strReturn = objXMLHTTP.responseXML
	
	Set objXMLHTTP = Nothing
	GetHTML = strReturn

	exit function
End Function
%>
Using objXMLHTTP.responseXML as in the example gives an error
Code:
Microsoft VBScript runtime error '800a01b6' 
Object doesn't support this property or method

Using objXMLHTTP.responseText of course produces plain text. Any ideas please?
 
Bad naming of strReturn if so desired.

>strReturn = objXMLHTTP.responseXML
[tt][red]set[/red] strReturn = objXMLHTTP.responseXML[/tt]

>GetHTML = strReturn
[tt][red]set[/red] GetHTML = strReturn[/tt]
 
Hi Tsuji, You may well be right, although what I was trying to get a fix on was the reason why objXMLHTTP.responseText was accepted (and returned a text string of contents but without the XML tags) using the syntax shown, while objXMLHTTP.responseXML was rejected.

Today, using either syntax option, and objXMLHTTP.responseXML, I'm getting an error message "Cannot view XML input using style sheet" - which is sounding healthier.

Does anyone know of a good FAQ for this?

Many thanks
 
Inspect .responsetext and you could discover it would not be a well-formed xml string.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top