I'm building a WebService that returns status of an object, so I get the object's data to search the base via SOAP message:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:agr="http://site.temp.br/">
<soapenv:Header/>
<soapenv:Body>
<agr:getObjeto_V1>
<arg0>
<TipoObjeto>C</TipoObjeto>
<CodigoObjeto>999999</CodigoObjeto>
<Valor>9999999999999</Valor>
<NomeObjeto>xxxxxxxxxxxx</NomeObjeto>
</arg0>
</agr:getObjeto_V1>
</soapenv:Body>
</soapenv:Envelope>
This is the soap message sent to the webservice, in the service I get this message quietly, but, I'm getting a bit to get the values of the nodes that are inside the arg0 node, I'm trying like this:
XmlDocument xml = new XmlDocument();
xml.LoadXml(xmlSoapRequest.InnerXml);
XmlNodeList xnList = xml.SelectNodes("/Envelope/Body/getObjeto_V1/arg0");
foreach (XmlNode xn in xnList)
{
char TipoObjeto = (char)xn["TipoObjeto"].InnerText[0];
string CodigoObjeto = xn["CodigoObjeto"].InnerText;
string valor = xn["Valor"].InnerText;
string NomeObjeto = xn["NomeObjeto"].InnerText;
}
How can I do this? If I have another way I do not have to select the attributes manually, but do the conversion directly to a class, I also accept it.