Problem reading a XML with namespace

Hi everyone,

I'm connecting my NAV to a webService, it's not my frist time, but it's the first time that the received XML file as namespaces. This is how the XML to read look like:

I need to read the "faultstring" node.

I've tried to read it with the tipical "FindNodeText" function, but of course, the namespace provokes an error. So, as I've read in some articles, I am using the NamesPace manager, like this:

XMLDocDotNet := XMLDocDotNet.XmlDocument;
XMLDocDotNet.Load('C:\XML\XXXX\Login\login.xml');
// 
// 
  IF ISCLEAR(XMLHTTP) THEN
   CREATE(XMLHTTP,FALSE,TRUE);
XMLHTTP.open('POST', 'http://wstest.envialia.com:9085/soap/LoginCli');
XMLHTTP.setRequestHeader('Content-Type: ', 'application/x-www-form-urlencoded');
XMLHTTP.setRequestHeader('Host','XXXX.com:9085/soap');
XMLHTTP.setRequestHeader('SOAPAction', 'http://XXXX.com:9085/soap/LoginCli');
 
SLEEP(1000);
XMLText := XMLDocDotNet.OuterXml;
SLEEP(1000);
XMLHTTP.send(XMLText);

 IF ISCLEAR(locautXmlDoc) THEN
  CREATE(locautXmlDoc,FALSE,TRUE);

response := XMLHTTP.responseText;
LoadXMLDocumentFromText(response, locautXmlDocNet);
nms.AddNamespace('soap-ENV', 'http://schemas.xmlsoap.org/soap/envelope');
errorCode := FindNodeText(locautXmlDocNet,'@soap-ENV:Body/@soap-ENV:Fault/faultstring');

And here, I get this error:

"An instance of the dotnet variable hasn't been created. Trying to call to system.... "

I know this could be a problem with the DotNet variable. I've changed "RunOnClient" property to YES, but same error. IS there a better way to read this XML? may be an XMLPort? Or am I doing something wrong?

Thank you very much

Parents Reply Children
Related
Recommended