Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/09/2011, 07:11
Avatar de Alishta7
Alishta7
 
Fecha de Ingreso: junio-2009
Mensajes: 25
Antigüedad: 14 años, 9 meses
Puntos: 0
Respuesta: Creacion de xml

Ya me di cuenta del error xDUU

me falto doc.AppendChild(node)

ahora si funciona :)

Código:
<WebMethod()> _
    Public Sub myThrow2()

        'Contruye el Detail de los elementos del SOAP fault.
        Dim doc As New System.Xml.XmlDocument()
        Dim node As System.Xml.XmlNode = _
            doc.CreateNode(XmlNodeType.Element, _
            SoapException.DetailElementName.Name, _
            SoapException.DetailElementName.Namespace)

            doc.AppendChild(node)

        Dim LogPath As String = Path() + "\" + NameFile().ToString().ToUpper()

        'Construye las especificaciones details del SoapException.
        'Agrega el primer hijo del elemento XML detail.
        Dim details As System.Xml.XmlNode = doc.CreateNode(XmlNodeType.Element, "mySpecialInfo1", "http://tempuri.org/")

        'Agrega un segundo hijo del elemento XML detail con un atributo.
        Dim details2 As System.Xml.XmlNode = doc.CreateNode(XmlNodeType.Element, "mySpecialInfo2", "http://tempuri.org/")
        Dim attr As XmlAttribute = doc.CreateAttribute("t", "attrName", "http://tempuri.org/")
        attr.Value = "attrValue"
        details2.Attributes.Append(attr)

        'Agrega el primer hijo del elemento XML detail.
        Dim details3 As System.Xml.XmlNode = doc.CreateNode(XmlNodeType.Element, "FaulType", "http://tempuri.org/")
        details3.InnerXml = "Valor del detalle"

        'Añade los dos elementos hijos del nodo detail.
        node.AppendChild(details)
        node.AppendChild(details2)
        node.AppendChild(details3)

        doc.Save(LogPath)

    End Sub

Última edición por Alishta7; 19/10/2011 a las 10:55