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

MapReduce con MongoDB

Posted on may - 18 - 2012

0 Comment

Habilitar la compresión de...

Posted on abr - 25 - 2012

0 Comment

Bamboo, MSBuild y referencias...

Posted on abr - 17 - 2012

2 Comments

Sponsors

  • Etooltech
  • Dingus Services
  • Etooltech
  • Dingus Services