-
SOAP and responses
Right let me explain what i'm doing, first i'm stuck with what version of soap I'm able to implement this in, its a 3rd party and its no change possible so please remember that in your answer.
But its in SOAP 1.1, with WDSL definitions, I send the SOAP definition to the server and get a lovely soap envelope returned no problems, To do this i'm using standard ASP using HTTP objects and standard post commands.
I can retrieve the data from the return in statement as follows,
But I have to deal with it as String and hack it all about to get the information I want out of it.
strReturn = objHTTP.responseBody
I know from my XML experience that you can do
objXML.selectSingleNode("//member[name='success']")
This sort of thing on an XML document and get the value you want, and i'm a stickler for doing things right - I'm hoping that SOAP has got a similar implementation.
Does anyone know or can anyone find it?, I've done google on this many times today so if you don't know it please don't paste google to me. Especially as i need the 1.1 version of SOAP and not V3 like everyone is going on about with asp.net which i'm not using.
Its not a dire situation but its something that will bug me immensly if there isn't a proper way of doing it.
Thanks in advance
TiG
-
Do you mean V3 of the SOAP toolkit? I was having a looksy at some SOAP sites and all I code see was SOAP version 1.1 and 1.2, 1.2 appeared around July 2003.
The SOAP toolkit v2 is available here http://msdn.microsoft.com/library/de...ist/websrv.asp and uses SOAP 1.1.
Which would make the (VB) client code look something like:
Code:
Dim soapClient
set soapclient = CreateObject("MSSOAP.SoapClient")
On Error Resume Next
Call soapclient.mssoapinit("http://localhost/DocSample1/DocSample1.wsdl", "DocSample1", "Sample1SoapPort")
if err <> 0 then
wscript.echo "initialization failed " + err.description
end if
wscript.echo soapclient.AddNumbers(2, 3) ' SOAP method to be called
if err <> 0 then
wscript.echo err.description
wscript.echo "faultcode=" + soapclient.faultcode
wscript.echo "faultstring=" + soapclient.faultstring
wscript.echo "faultactor=" + soapclient.faultactor
wscript.echo "detail=" + soapclient.detail
end if
-
Mart,
Thanks for the response but where do you answer my question?.
How do I expect specific elements from a return SOAP envelop using soap 1.1 using ASP.
All you are doing in the code above is echoing info to the screen. I need to strip out 3 fields from 7 returned and i'd rather do this by selecting soap.element(x) etc.
But i've still not been able to find a method like this as exists in XML.
TiG
-
Sorry, I misread the question. I thought you were looking for a proxy object that you could do obj.method or obj.Prop. There is a tool in the SOAP toolkit that can generate the proxy for you.
Back to your original question, you should be able to load the response body into an XMLDocument object... (or have I missed the point again :) )
Code:
xmlDoc = Server.CreateObject("Msxml2.DOMDocument.4.0")
xmlDoc.loadXML(httpReq.responseBody) 'Load XML from string
xmlDoc.selectSingleNode("//member[name='success']")
The code snippet uses MSXML4 but it should work ok with versions 2 and 3 if you change the CreateObject string.
-