/// <summary> /// Writes a message in SOAP/XML. /// </summary> public static void WriteSoapMessage( Stream ostrm, string typeName, IEncodeable message, ServiceMessageContext messageContext) { XmlWriterSettings settings = new XmlWriterSettings(); settings.Encoding = System.Text.Encoding.UTF8; settings.OmitXmlDeclaration = false; XmlWriter writer = XmlWriter.Create(ostrm, settings); writer.WriteStartElement("soap12", "Envelope", "http://www.w3.org/2003/05/soap-envelope"); XmlEncoder encoder = new XmlEncoder( new XmlQualifiedName("Body", "http://www.w3.org/2003/05/soap-envelope"), writer, messageContext); encoder.PushNamespace(Namespaces.OpcUaXsd); encoder.WriteEncodeable( typeName, message, null); encoder.PopNamespace(); writer.WriteEndElement(); writer.WriteEndElement(); writer.Flush(); }
/// <summary> /// Writes a message in SOAP/XML. /// </summary> public static void WriteSoapMessage( Stream ostrm, string typeName, IEncodeable message, ServiceMessageContext messageContext) { XmlWriterSettings settings = new XmlWriterSettings(); settings.Encoding = System.Text.Encoding.UTF8; settings.OmitXmlDeclaration = false; XmlWriter writer = XmlWriter.Create(ostrm, settings); writer.WriteStartElement("soap12", "Envelope", "http://www.w3.org/2003/05/soap-envelope"); XmlEncoder encoder = new XmlEncoder( new XmlQualifiedName("Body", "http://www.w3.org/2003/05/soap-envelope"), writer, messageContext); encoder.PushNamespace(Namespaces.OpcUaXsd); encoder.WriteEncodeable( typeName, message, null); encoder.PopNamespace(); writer.WriteEndElement(); writer.WriteEndElement(); writer.Flush(); }