Any leads/help/ideas are greatly appreciated. I'm getting a response back
from a SOAP server and under classic ASP I was able to process the xml fine.
The app is being ported to c# and the same approach isn't working as well.
It fails at the xpath query after the results come back.
XML response:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<CheckResponse xmlns="http://local.domain.com">
<CheckResult>...
Code:
public int getBatchItemCount(XmlDocument oXML)
{
if (oXML != null)
{
XmlNamespaceManager nsmgr = new
XmlNamespaceManager(oXML.NameTable);
nsmgr.AddNamespace("xsd",
"http://www.w3.org/2001/XMLSchema");
nsmgr.AddNamespace("soap",
"http://schemas.xmlsoap.org/soap/envelope/");
nsmgr.AddNamespace("xsi",
"http://www.w3.org/2001/XMLSchema-instance");
XmlNode oNode;
oNode =
oXML.DocumentElement.SelectSingleNode("//soap:Envelope/soap:Body/CheckRespon
se", nsmgr);
if (oNode == null)
{
return -999;
}
else
{
return oNode.ChildNodes.Count;
}
}
else
{
return 0;
}
}
The select always fails to return a result is I try to drill down past the
soap:Body as in the above. It's almost as if the different namespace listed
on the first element in the body is tripping it up. I tried adding
nsmgr.AddNamespace("", http://local.domain.com) but that didn't help either.
thanks,
jk