Accessing SOAP xml data with classic ASP
I've got a string variable, named strMethodResultXML, that has the contents of a SOAP xml response and would like to output only the actual data to the browser screen.
I'm using this: Response.Write strMethodResultXML
However, the output isn't correct and when I view the source code in the browser, it's outputting all the xml with the tags.
Any help?
Thank you.
Re: Accessing SOAP xml data with classic ASP
Your problem would be how you are setting strMethodResultXML. By the sound of it, you are probably retrieving the XML structure and not just the response text.
Re: Accessing SOAP xml data with classic ASP
Here's my exact code:
Code:
<%
Dim objXMLHTTP : SET objXMLHTTP = Server.CreateObject("Msxml2.XMLHTTP.3.0")
Dim objOutputXMLDoc : Set objOutputXMLDoc = Server.CreateObject("MSXML.DOMDocument")
Dim strMethodPkg
Dim strMethodResultXML
strMethodPkg ="<?xml version=""1.0"" encoding=""ISO-8859-1""?>"
strMethodPkg = strMethodPkg &"<SOAP-ENV:Envelope SOAP-ENV:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/"" xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:SOAP-ENC=""http://schemas.xmlsoap.org/soap/encoding/"">"
strMethodPkg = strMethodPkg &"<SOAP-ENV:Body>"
strMethodPkg = strMethodPkg &"<ns9005:showSearchForm xmlns:ns9005=""http://tempuri.org"">"
strMethodPkg = strMethodPkg &"</ns9005:showSearchForm>"
strMethodPkg = strMethodPkg &"</SOAP-ENV:Body>"
strMethodPkg = strMethodPkg &"</SOAP-ENV:Envelope>"
objXMLHTTP.open "post", "http://www.webservicesite.com/service.wsdl", False
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=ISO-8859-1"
objXMLHTTP.setRequestHeader "Content-Length", Len(strMethodPkg)
objXMLHTTP.setRequestHeader "SOAPAction", "http://www.webservicesite.com/service.wsdl"
Call objXMLHTTP.send(strMethodPkg)
strMethodResultXML = objXMLHTTP.responsetext
Response.Write strMethodResultXML
%>
Re: Accessing SOAP xml data with classic ASP
Your code is correct. It should just be giving you text. So, it would seem that the text being send back is HTML encoding. I bet you aren't receiving < and > signs, but instead < and >.
Re: Accessing SOAP xml data with classic ASP
Yes, the SOAP data response I receive contains HTML tags (such as a table) and they do display as entities. I'm also having this problem with .NET, but with NuSoap in PHP the data appears as a table when I output it to the browser.
Re: Accessing SOAP xml data with classic ASP
Quote:
Originally Posted by
KnightDeveloper
I'm also having this problem with .NET, but with NuSoap in PHP the data appears as a table when I output it to the browser.
Are you sure that it is actual tables and not just XSLT styling to make it look like tables?