Mas de mi servicio "impersonal" …

Resulta que ahora también recibe documentos SOAP, así que tengo que extraer los datos del mensaje SOAP con este código:

private XmlDocument GetSOAPBody(XmlDocument xmlSoap)
    {

              const string SOAP_NAMESPACE = "http://schemas.xmlsoap.org/soap/envelope/";
              XmlNodeList nodes = xmlSoap.GetElementsByTagName("Body", SOAP_NAMESPACE);

          if (nodes.Count == 0) return xmlSoap;

          XmlElement body = (XmlElement)nodes.Item(0);

          nodes = body.ChildNodes;
          for (int i = 0; i < nodes.Count; i++)
          {
              XmlNode node = nodes.Item(i);
              if (node is XmlElement)
              {
                  xmlSoap = new XmlDocument();
                  xmlSoap.LoadXml(node.OuterXml);
                  IsSOAP = true;
                  return xmlSoap;
              }
          }

          return xmlSoap;
      }  

Funciona bastante bien, ahora estoy con el de generar las respuestas de OK y de Error, ya lo publicare :)

Categories: , , ,

Leave a Reply


*

PUBLICIDAD

EMAIL





posts recientes

Instala la ultima versión...

Posted on ene - 23 - 2012

0 Comment

primer Vistazo al framework...

Posted on ene - 12 - 2012

0 Comment

Changelog de MongoMapper.NET

Posted on ene - 5 - 2012

0 Comment

Sponsors

  • Etooltech
  • Dingus Services
  • Etooltech
  • Dingus Services