public static string NamespacePrefix(this EnvelopeVersion envelopeVersion, XmlNamespaceManager namespaces)
        {
            string prefix;

            if (envelopeVersion == EnvelopeVersion.Soap11)
            {
                prefix = Namespaces.AddNamespaceIfNotAlreadyPresentAndGetPrefix(namespaces, "s", Namespaces.SOAP11_ENVELOPE_NS);
                return(prefix);
            }

            prefix = Namespaces.AddNamespaceIfNotAlreadyPresentAndGetPrefix(namespaces, "s", Namespaces.SOAP12_ENVELOPE_NS);
            return(prefix);
        }
Beispiel #2
0
        protected override void OnWriteStartEnvelope(XmlDictionaryWriter writer)
        {
            var namespaces = NamespaceManager ?? Namespaces.CreateDefaultXmlNamespaceManager();

            writer.WriteStartDocument();
            var prefix = Version.Envelope.NamespacePrefix(namespaces);

            writer.WriteStartElement(prefix, "Envelope", Version.Envelope.Namespace());
            writer.WriteXmlnsAttribute(prefix, Version.Envelope.Namespace());

            var xsdPrefix = Namespaces.AddNamespaceIfNotAlreadyPresentAndGetPrefix(namespaces, "xsd", Namespaces.XMLNS_XSD);

            writer.WriteXmlnsAttribute(xsdPrefix, Namespaces.XMLNS_XSD);

            var xsiPrefix = Namespaces.AddNamespaceIfNotAlreadyPresentAndGetPrefix(namespaces, "xsi", Namespaces.XMLNS_XSI);

            writer.WriteXmlnsAttribute(xsiPrefix, Namespaces.XMLNS_XSI);
        }