I need to find the tag 200 using the service trace viewer, it looks something like that!
<SOAP-ENV:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="id-14799">
<ns2:SendInvoice xmlns:ns2="http://www.zadrwan.com/services/" xmlns:ns3="http://www.zadrwan.com/services/DocumentSendTo" xmlns:ns4="http://www.zadrwan.com/services/VersionRequest">
<ns2:Response>200</ns2:Response>
<ns2:Comments>Success!.</ns2:Comments>
</ns2:SendInvoice>
when running the webservice does the Trace and writes an E2ETraceEvent the first one I don't need it, but the second one E2ETraceEvent (request) is the one I need and where is the
I found some code on this page monitoring-and-reading-svclog-file
my code is like this:
XmlReader reader = XmlReader.Create(stream, settings);
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
if (reader.Name == "E2ETraceEvent")
{
XmlReader subReader = reader.ReadSubtree();
while (subReader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
while (reader.Name == "Body")
{
Console.WriteLine(subReader.ReadOuterXml());
}
break;
}
}
}
break;
}
}
how do i catch the second one, with the tag that contains n2 response ??
You need to add the namespace. Something like:
using (XmlReader reader = XmlReader.Create(new StringReader(xml)))
{
XmlNamespaceManager nsmanager = new XmlNamespaceManager(reader.NameTable);
nsmanager.AddNamespace("ns2", "http://www.zadrwan.com/services/");
while (reader.Read())
{
switch (reader.Name)
{
case "ns2:Response":
Console.WriteLine(reader.Name);
Console.WriteLine(reader.ReadInnerXml());
break;
}
}
}