Quantcast
Channel: NAV Three Tier — mibuso.com
Viewing all articles
Browse latest Browse all 10032

How do I declare a blank namespace with the .NET components?

$
0
0
I've been asked to create a piece of code that connects to a webservice, sends some information and handles the response.
Sending and collecting the response goes fine, but when trying to handle the response, I'm stomped by a blank namespace declaration :(

The responsexml I get is:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
<s:Body>
<SendOrderResponse xmlns="http://tempuri.org/"&gt;
<SendOrderResult xmlns:a="http://schemas.datacontract.org/2004/07/Scalepoint.Web.EasyClaims.Webservices.DealerManagement&quot; xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt;
<a:Description>...</a:Description>
<a:ResultCode>SCHEMA_VALIDATION_ERROR</a:ResultCode>
<a:ResultDetails i:nil="true"/>
</SendOrderResult>
</SendOrderResponse>
</s:Body>
</s:Envelope>

To handle this I have:
// Create NameSpacemanager
XmlNamespaceManager := XmlNamespaceManager.XmlNamespaceManager(XmlDocument.NameTable);
XmlNamespaceManager.AddNamespace('s','http://schemas.xmlsoap.org/soap/envelope/');
XmlNamespaceManager.AddNamespace('','http://tempuri.org/');
XmlNamespaceManager.AddNamespace('a','http://schemas.datacontract.org/2004/07/Scalepoint.Web.EasyClaims.Webservices.DealerManagement');
XmlNamespaceManager.AddNamespace('i','http://www.w3.org/2001/XMLSchema-instance');

and then I want to do a:
//Find ResponseCode
XmlCurrNode := XmlDocument.SelectSingleNode('s:Envelope/s:Body/SendOrderResponse/SendOrderResult/a:ResultCode', XmlNamespaceManager);

Doing a SelectSingleNode on just 's:Body' works, as does selecting 's:Envelope/s:Body'.
But as soon as I go to the SendOrderResponse my Node is uninitialized :(
I suspect I'm using/declaring the manager incorrectly, so any pointers would be welcome.

Viewing all articles
Browse latest Browse all 10032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>