Click to See Complete Forum and Search --> : Accessing SOAP xml data with classic ASP


KnightDeveloper
July 30th, 2009, 01:29 PM
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.

PeejAvery
July 30th, 2009, 01:51 PM
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.

KnightDeveloper
July 30th, 2009, 06:16 PM
Here's my exact 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
%>

PeejAvery
July 30th, 2009, 09:38 PM
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 &lt; and &gt;.

KnightDeveloper
July 31st, 2009, 12:04 PM
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.

PeejAvery
July 31st, 2009, 12:32 PM
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?