Hello guys, I hope you can help me with this little problem. I'm posting a SOAP envelope to a server, I receive the response from it, but at the moment I want to get the values from it, I received the following error: Reference to undeclared namespace prefix: 'SOAP' Here's the code: xmlhttp.send(SoapTest) if xmlhttp.Status = 200 then dim strResponseLN: set strResponseLN = server.CreateObject("MSXML2.DOMDocument.4.0") strResponseLN.validateOnParse=true strResponseLN.load response strResponseLN.setProperty "SelectionNamespaces","xmlns:Soap='http://www.w3.org/2001/XMLSchema'" if not strResponseLN.SelectSingleNode ("SOAP:Envelope/SOAP:Body/x:CashmoResponse/reference") is nothing then 'Error is genereted on this line. oNode= strResponseLN.selectSingleNode("SOAP:Envelope/SOAP:Body/x:CashmoResponse/reference").Text response.Write onode response.End Else response.Write "there's nothing" response.End end If End if I can verify that the XML is being received because I can write it to disc using the file system object, and this is what it looks like: <?xml version="1.0" encoding="utf-8"?> <SOAP:Envelope xmlns:SOAP="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP:Body> <x:CashmoResponse> <reference>581142913922</reference> </x:CashmoResponse> </SOAP:Body> </SOAP:Envelope> Any hekp will be appreciated.
XML is case sensitive, you have 'SOAP' in your XPath but 'Soap' when you set the selection namespaces. -- Joe Fawcett - XML MVP https://mvp.support.microsoft.com/profile=8AA9D5F5-E1C2-44C7-BCE8-8741D22D17A5 "Mmogollon" wrote in message news:1146156153.330788.193750@g10g2000cwb.googlegroups.com... > Hello guys, I hope you can help me with this little problem. I'm > posting a SOAP envelope to a server, I receive the response from it, > but at the moment I want to get the values from it, I received the > following error: > > Reference to undeclared namespace prefix: 'SOAP' > > Here's the code: > > xmlhttp.send(SoapTest) > if xmlhttp.Status = 200 then > dim strResponseLN: set strResponseLN = > server.CreateObject("MSXML2.DOMDocument.4.0") > strResponseLN.validateOnParse=true > strResponseLN.load response > strResponseLN.setProperty > "SelectionNamespaces","xmlns:Soap='http://www.w3.org/2001/XMLSchema'" > if not strResponseLN.SelectSingleNode > ("SOAP:Envelope/SOAP:Body/x:CashmoResponse/reference") is nothing then > 'Error is genereted on this line. > oNode= > strResponseLN.selectSingleNode("SOAP:Envelope/SOAP:Body/x:CashmoResponse/reference").Text > response.Write onode > response.End > Else > response.Write "there's nothing" > response.End > end If > End if > > I can verify that the XML is being received because I can write it to > disc using the file system object, and this is what it looks like: > > <?xml version="1.0" encoding="utf-8"?> > <SOAP:Envelope xmlns:SOAP="http://www.w3.org/2003/05/soap-envelope" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <SOAP:Body> > <x:CashmoResponse> > <reference>581142913922</reference> > </x:CashmoResponse> > </SOAP:Body> > </SOAP:Envelope> > > > > Any hekp will be appreciated. >
Thanks for your reply Joe. I tried that already, with no success. What else do you think could be wrong? Could it be the server not sending the correct headers?. Thanks
"Mmogollon" wrote in message news:1146493392.499789.272810@j33g2000cwa.googlegroups.com... > Thanks for your reply Joe. I tried that already, with no success. What > else do you think could be wrong? Could it be the server not sending > the correct headers?. > > Thanks Normally I'd do: xmlHttp.send(SoapTest) If xmlHttp.status = 200 Then Dim oDoc Set oDoc = server.CreateObject("MSXML2.DOMDocument.4.0") oDoc.setProperty "SelectionNamespaces","xmlns:SOAP='http://www.w3.org/2001/XMLSchema'" Dim bLoaded bLoaded = oDoc.load(xmlHttp.responseXML) If bLoaded Then 'Do something with doc Else 'Error End If End If -- Joe Fawcett (MVP - XML) https://mvp.support.microsoft.com/profile=8AA9D5F5-E1C2-44C7-BCE8-8741D22D17A5