Click to See Complete Forum and Search --> : Accessing contents of SOAP XML
KnightDeveloper
07-30-2009, 01:25 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?
Kuriyama
07-30-2009, 02:27 PM
Classic does not fully support SOAP, and It doesn't come with a standard framework for accessing or building web services. Please post code for more information.
KnightDeveloper
07-30-2009, 06:19 PM
Here's the code I'm using. I need it to output the data and not the entire xml structure.
<%
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
%>
Kuriyama
07-31-2009, 07:54 AM
Here is a hint, if the service you are calling is returning an XML file. .. why not try to open your XHR request using MS XMLParser?
KnightDeveloper
07-31-2009, 12:09 PM
I'm trying to create the SOAP client so that it is compatible to as many people as possible. People would simply upload the client files to their server and will be able to access my SOAP service; I'm assuming this person knows nothing about websites and should be able to perform an FTP upload to their server.
Something else about the data being returned is that it contains HTML tags. So this might be a reason why I'm getting the whole XML structure, or no?
Kuriyama
07-31-2009, 12:24 PM
I'm sorry I misunderstood your question. I thought you where calling a web service for data, not trying to create one using ASP.
I believe that this line. .
Call objXMLHTTP.send(strMethodPkg)
Is just spitting up the text, and it's automatically returning a content-type of text/html. what I would do is just response.write everything to the page at the end. Also, move your content-type call to the top of the page.
I hope that helps.