XML : xml soap message in metro apps (error while adding attributes)

I am trying to write an soap message for DatagramSocket in C# metro enviroment. So far I have written:

          XElement soapX =              new XElement("Envelope",                      new XAttribute("xmlsa", "http://schemas.xmlsoap.org/ws/2004/08/addressing"),                      new XAttribute("xmlss", "http://www.w3.org/2003/05/soap-envelope"),                  new XElement("Header",                      new XElement("Action", "http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe",                          new XAttribute("mustUnderstand", 1)),                      new XElement("MessageID", uuid),                      new XElement("ReplyTo",                          new XElement("Address", "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous")),                      new XElement("To", "urn:schemas-xmlsoap-org:ws:2005:04:discovery",                          new XAttribute("mustUnderstand", 1))                  ),                  new XElement("Body",                      new XElement("Probe",                                  new XAttribute("xmls", "http://schemas.xmlsoap.org/ws/2005/04/discovery"),                          new XElement("Types", "dp0:NetworkVideoTransmitter",                                  new XAttribute("xmlsdp0", "http://www.onvif.org/ver10/network/wsdl"),                                  new XAttribute("xmls", "http://schemas.xmlsoap.org/ws/2005/04/discovery"))                      )                  )              );    

But this code has several issues:

1.when I change any xmls.. to xmlns.. I get error

A first chance exception of type 'System.Xml.XmlException' occurred in SYSTEM.XML.NI.DLL

2.When I change Envelope to s:Envelope (which I think is obligatory) I also get the same error.

Has anyone

No comments:

Post a Comment