static void Main(string[] args)
        {
            // MessageVersion
            EnvelopeVersion envS11      = EnvelopeVersion.Soap11;
            string          nextDestS11 = envS11.NextDestinationActorValue;

            string[] ultDestsS11 = envS11.GetUltimateDestinationActorValues();
            string   ultS11      = ultDestsS11[0];
            string   toStrS11    = envS11.ToString();

            EnvelopeVersion envS12 = EnvelopeVersion.Soap12;

            EnvelopeVersion envNotSOAP = EnvelopeVersion.None;

            string nextDestS12 = envS12.NextDestinationActorValue;

            string[] ultDestsS12 = envS12.GetUltimateDestinationActorValues();

            string ultS12 = ultDestsS12[1];

            string toStrS12 = envS12.ToString();

            EnvelopeVersion envNone      = EnvelopeVersion.None;
            string          nextDestNone = envNone.NextDestinationActorValue;
            //The following code throws a System.ArgumentReferenceExeption.
            //The object reference is not set to an instance of an object
            // string[] ultDestsNone = envNone.GetUltimateDestinationActorValues();
            string toStrNone = envNone.ToString();

            //EnvelopeVersions
            Console.WriteLine("EnvelopeVersion.Soap11: {0}", envS11);
            Console.WriteLine("EnvelopeVersion.Soap12: {0}", envS12);
            Console.WriteLine("EnvelopeVersion.None: {0}", envNone);
            Console.WriteLine();

            //NextDestination
            Console.WriteLine("NextDest EnvelopeVersion.Soap11: {0}", nextDestS11);
            Console.WriteLine("NextDest EnvelopeVersion.Soap12: {0}", nextDestS12);
            Console.WriteLine("NextDest EnvelopeVersion.None: {0}", nextDestNone);
            Console.WriteLine();

            //UltimateDestinations
            Console.WriteLine("UltDest EnvelopeVersion.Soap11: {0}", ultS11);
            Console.WriteLine("UltDest EnvelopeVersion.Soap12: {0}", ultS12);
            //Console.WriteLine("UltDest EnvelopeVersion.None: {0}", ultDestsNone);
            Console.WriteLine();

            //ToString
            Console.WriteLine("EnvelopeVersion.Soap11.ToString(): {0}", toStrS11);
            Console.WriteLine("EnvelopeVersion.Soap11.ToString(): {0}", toStrS12);
            Console.WriteLine("EnvelopeVersion.Soap11.ToString(): {0}", toStrNone);
            Console.WriteLine();
        }
Esempio n. 2
0
 internal static string GetEncoding(EnvelopeVersion version)
 {
     if (version == EnvelopeVersion.Soap11)
     {
         return("http://schemas.xmlsoap.org/soap/encoding/");
     }
     if (version != EnvelopeVersion.Soap12)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("version", System.ServiceModel.SR.GetString("EnvelopeVersionNotSupported", new object[] { version }));
     }
     return("http://www.w3.org/2003/05/soap-encoding");
 }
Esempio n. 3
0
 public void WriteTo(XmlDictionaryWriter writer,
                     EnvelopeVersion version)
 {
     writer.WriteStartElement("Fault", version.Namespace);
     WriteFaultCode(writer, version, Code, false);
     WriteReason(writer, version);
     if (HasDetail)
     {
         OnWriteDetail(writer, version);
     }
     writer.WriteEndElement();
 }
 public StreamedMessage(XmlDictionaryReader reader, int maxSizeOfHeaders, MessageVersion desiredVersion)
 {
     if (reader.NodeType != XmlNodeType.Element)
     {
         reader.MoveToContent();
     }
     if (desiredVersion.Envelope == EnvelopeVersion.None)
     {
         this.reader           = reader;
         this.headerAttributes = XmlAttributeHolder.emptyArray;
         this.headers          = new MessageHeaders(desiredVersion);
     }
     else
     {
         this.envelopeAttributes = XmlAttributeHolder.ReadAttributes(reader, ref maxSizeOfHeaders);
         this.envelopePrefix     = reader.Prefix;
         EnvelopeVersion envelopeVersion = ReceivedMessage.ReadStartEnvelope(reader);
         if (desiredVersion.Envelope != envelopeVersion)
         {
             Exception innerException = new ArgumentException(System.ServiceModel.SR.GetString("EncoderEnvelopeVersionMismatch", new object[] { envelopeVersion, desiredVersion.Envelope }), "reader");
             throw TraceUtility.ThrowHelperError(new CommunicationException(innerException.Message, innerException), this);
         }
         if (ReceivedMessage.HasHeaderElement(reader, envelopeVersion))
         {
             this.headerPrefix     = reader.Prefix;
             this.headerAttributes = XmlAttributeHolder.ReadAttributes(reader, ref maxSizeOfHeaders);
             this.headers          = new MessageHeaders(desiredVersion, reader, this.envelopeAttributes, this.headerAttributes, ref maxSizeOfHeaders);
         }
         else
         {
             this.headerAttributes = XmlAttributeHolder.emptyArray;
             this.headers          = new MessageHeaders(desiredVersion);
         }
         if (reader.NodeType != XmlNodeType.Element)
         {
             reader.MoveToContent();
         }
         this.bodyPrefix = reader.Prefix;
         ReceivedMessage.VerifyStartBody(reader, envelopeVersion);
         this.bodyAttributes = XmlAttributeHolder.ReadAttributes(reader, ref maxSizeOfHeaders);
         if (base.ReadStartBody(reader))
         {
             this.reader = reader;
         }
         else
         {
             this.quotas = new XmlDictionaryReaderQuotas();
             reader.Quotas.CopyTo(this.quotas);
             reader.Close();
         }
     }
 }
Esempio n. 5
0
 public static MessageVersion CreateVersion(EnvelopeVersion envelopeVersion, AddressingVersion addressingVersion)
 {
     if (envelopeVersion == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("envelopeVersion");
     }
     if (addressingVersion == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("addressingVersion");
     }
     if (envelopeVersion == EnvelopeVersion.Soap12)
     {
         if (addressingVersion == AddressingVersion.WSAddressing10)
         {
             return(soap12Addressing10);
         }
         if (addressingVersion == AddressingVersion.WSAddressingAugust2004)
         {
             return(soap12Addressing200408);
         }
         if (addressingVersion != AddressingVersion.None)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("addressingVersion", System.ServiceModel.SR.GetString("AddressingVersionNotSupported", new object[] { addressingVersion }));
         }
         return(soap12);
     }
     if (envelopeVersion == EnvelopeVersion.Soap11)
     {
         if (addressingVersion == AddressingVersion.WSAddressing10)
         {
             return(soap11Addressing10);
         }
         if (addressingVersion == AddressingVersion.WSAddressingAugust2004)
         {
             return(soap11Addressing200408);
         }
         if (addressingVersion != AddressingVersion.None)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("addressingVersion", System.ServiceModel.SR.GetString("AddressingVersionNotSupported", new object[] { addressingVersion }));
         }
         return(soap11);
     }
     if (envelopeVersion != EnvelopeVersion.None)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("envelopeVersion", System.ServiceModel.SR.GetString("EnvelopeVersionNotSupported", new object[] { envelopeVersion }));
     }
     if (addressingVersion != AddressingVersion.None)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("addressingVersion", System.ServiceModel.SR.GetString("AddressingVersionNotSupported", new object[] { addressingVersion }));
     }
     return(none);
 }
Esempio n. 6
0
        /// <summary>
        /// Get MessageVersion from the Message represented by XElement
        /// </summary>
        /// <param name="root"></param>
        /// <returns></returns>
        public static MessageVersion GetMessageVersion(XElement root)
        {
            var envelope = root.DescendantsAndSelf().FirstOrDefault(e => e.Name.LocalName == "Envelope");

            if (envelope != null)
            {
                string nsEnv  = envelope.Name.NamespaceName;
                var    action = envelope.Descendants().FirstOrDefault(e => e.Name.LocalName == "Action");
                if (action != null)
                {
                    string nsAction = action.Name.NamespaceName;
                    if (!string.IsNullOrEmpty(nsEnv) && !string.IsNullOrEmpty(nsAction))
                    {
                        EnvelopeVersion envVersion = null;
                        if (nsEnv == "http://schemas.xmlsoap.org/soap/envelope/")
                        {
                            envVersion = EnvelopeVersion.Soap11;
                        }
                        else if (nsEnv == "http://www.w3.org/2003/05/soap-envelope")
                        {
                            envVersion = EnvelopeVersion.Soap12;
                        }
                        else if (nsEnv == "http://schemas.microsoft.com/ws/2005/05/envelope/none")
                        {
                            envVersion = EnvelopeVersion.None;
                        }

                        if (envVersion != null)
                        {
                            AddressingVersion addrVersion = null;
                            if (nsAction == "http://www.w3.org/2005/08/addressing")
                            {
                                addrVersion = AddressingVersion.WSAddressing10;
                            }
                            else if (nsAction == "http://schemas.xmlsoap.org/ws/2004/08/addressing")
                            {
                                addrVersion = AddressingVersion.WSAddressingAugust2004;
                            }
                            else if (nsAction == "http://schemas.microsoft.com/ws/2005/05/addressing/none")
                            {
                                addrVersion = AddressingVersion.None;
                            }
                            if (addrVersion != null)
                            {
                                return(System.ServiceModel.Channels.MessageVersion.CreateVersion(envVersion, addrVersion));
                            }
                        }
                    }
                }
            }
            return(System.ServiceModel.Channels.MessageVersion.None);
        }
Esempio n. 7
0
        public static Message CreateWCFMessage(SoapEnvelopeVersion soapVersion,
                                               WSAddressingVersion wsaddressVersion,
                                               string action,
                                               string body)
        {
            EnvelopeVersion   eVersion = GetEnvelopVersion(soapVersion);
            AddressingVersion aVersion = GetAddressingVersion(wsaddressVersion);
            MessageVersion    mVersion = MessageVersion.CreateVersion(eVersion, aVersion);
            //Note: the XmlReader should not be dispose during the message lifecyle
            Message msg = Message.CreateMessage(mVersion, action, XmlReader.Create(new StringReader(body)));

            return(msg);
        }
        private static void ApplyAddressingVersion(MessageEncodingBindingElement encodingBindingElement, AddressingVersion addressingVersion)
        {
            EnvelopeVersion envelope = encodingBindingElement.MessageVersion.Envelope;

            if ((envelope == EnvelopeVersion.None) && (addressingVersion != AddressingVersion.None))
            {
                encodingBindingElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, addressingVersion);
            }
            else
            {
                encodingBindingElement.MessageVersion = MessageVersion.CreateVersion(envelope, addressingVersion);
            }
        }
        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);
        }
Esempio n. 10
0
        public static MessageFault CreateFault(Message message, int maxBufferSize)
        {
            if (message == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException(nameof(message)));
            }

            XmlDictionaryReader reader = message.GetReaderAtBodyContents();

            using (reader)
            {
                try
                {
                    EnvelopeVersion envelopeVersion = message.Version.Envelope;
                    MessageFault    fault;
                    if (envelopeVersion == EnvelopeVersion.Soap12)
                    {
                        fault = ReceivedFault.CreateFault12(reader, maxBufferSize);
                    }
                    else if (envelopeVersion == EnvelopeVersion.Soap11)
                    {
                        fault = ReceivedFault.CreateFault11(reader, maxBufferSize);
                    }
                    else if (envelopeVersion == EnvelopeVersion.None)
                    {
                        fault = ReceivedFault.CreateFaultNone(reader, maxBufferSize);
                    }
                    else
                    {
                        throw TraceUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.EnvelopeVersionUnknown, envelopeVersion.ToString())), message);
                    }
                    message.ReadFromBodyContentsToEnd(reader);
                    return(fault);
                }
                catch (InvalidOperationException e)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CommunicationException(
                                                                                  SR.SFxErrorDeserializingFault, e));
                }
                catch (FormatException e)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CommunicationException(
                                                                                  SR.SFxErrorDeserializingFault, e));
                }
                catch (XmlException e)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CommunicationException(
                                                                                  SR.SFxErrorDeserializingFault, e));
                }
            }
        }
Esempio n. 11
0
 protected override void OnWriteStartDetail(XmlDictionaryWriter writer, EnvelopeVersion version)
 {
     using (XmlReader reader = this.detail.GetReader(0))
     {
         base.OnWriteStartDetail(writer, version);
         while (reader.MoveToNextAttribute())
         {
             if (this.ShouldWriteDetailAttribute(version, reader.Prefix, reader.LocalName, reader.Value))
             {
                 writer.WriteAttributeString(reader.Prefix, reader.LocalName, reader.NamespaceURI, reader.Value);
             }
         }
     }
 }
Esempio n. 12
0
        public static Message CreateWCFMessageWithEnvelope(SoapEnvelopeVersion soapVersion,
                                                           WSAddressingVersion wsaddressVersion,
                                                           string action,
                                                           string envelope)
        {
            EnvelopeVersion   eVersion = GetEnvelopVersion(soapVersion);
            AddressingVersion aVersion = GetAddressingVersion(wsaddressVersion);
            MessageVersion    mVersion = MessageVersion.CreateVersion(eVersion, aVersion);
            //Note: the XmlReader should not be dispose during the message lifecyle
            Message msg = Message.CreateMessage(XmlReader.Create(new StringReader(envelope)), 99999999, mVersion);

            msg.Headers.Action = action;
            return(msg);
        }
Esempio n. 13
0
 private static FaultCode ReadFaultCode12Driver(XmlDictionaryReader reader, EnvelopeVersion version)
 {
     reader.ReadStartElement(XD.Message12Dictionary.FaultValue, version.DictionaryNamespace);
     XmlUtil.ReadContentAsQName(reader, out string localName, out string ns);
     reader.ReadEndElement();
     if (reader.IsStartElement(XD.Message12Dictionary.FaultSubcode, version.DictionaryNamespace))
     {
         reader.ReadStartElement();
         FaultCode subCode = ReadFaultCode12Driver(reader, version);
         reader.ReadEndElement();
         return(new FaultCode(localName, ns, subCode));
     }
     return(new FaultCode(localName, ns));
 }
Esempio n. 14
0
        private bool ShouldWriteDetailAttribute(EnvelopeVersion targetVersion, string prefix, string localName, string attributeValue)
        {
            // Handle fault detail version conversion from Soap12 to Soap11 -- scope tightly to only conversion from Soap12 -> Soap11
            // SOAP 1.1 specifications allow an arbitrary element within <fault>, hence:
            // transform this IFF the SOAP namespace specified will affect the namespace of the <detail> element,
            // AND the namespace specified is exactly the Soap12 Namespace.
            bool shouldSkip = _receivedVersion == EnvelopeVersion.Soap12 && // original incoming version
                              targetVersion == EnvelopeVersion.Soap11 &&    // version to serialize to
                              string.IsNullOrEmpty(prefix) &&               // attribute prefix
                              localName == "xmlns" &&                       // only transform namespace attributes, don't care about others
                              attributeValue == XD.Message12Dictionary.Namespace.Value;

            return(!shouldSkip);
        }
Esempio n. 15
0
        internal static SoapAddressBinding GetOrCreateSoapAddressBinding(Binding wsdlBinding, Port wsdlPort, WsdlExporter exporter)
        {
            if (GetSoapVersionState(wsdlBinding, exporter) == EnvelopeVersion.None)
            {
                return(null);
            }
            SoapAddressBinding soapAddressBinding = GetSoapAddressBinding(wsdlPort);
            EnvelopeVersion    soapVersion        = GetSoapVersion(wsdlBinding);

            if (soapAddressBinding != null)
            {
                return(soapAddressBinding);
            }
            return(CreateSoapAddressBinding(soapVersion, wsdlPort));
        }
 protected virtual void OnWriteStartDetail(XmlDictionaryWriter writer, EnvelopeVersion version)
 {
     if (version == EnvelopeVersion.Soap12)
     {
         writer.WriteStartElement(XD.Message12Dictionary.FaultDetail, XD.Message12Dictionary.Namespace);
     }
     else if (version == EnvelopeVersion.Soap11)
     {
         writer.WriteStartElement(XD.Message11Dictionary.FaultDetail, XD.Message11Dictionary.FaultNamespace);
     }
     else
     {
         writer.WriteStartElement(XD.Message12Dictionary.FaultDetail, XD.MessageDictionary.Namespace);
     }
 }
Esempio n. 17
0
 private static SoapEnvelopeVersion GetSoapEnvelopeVersion(EnvelopeVersion version)
 {
     if (version == EnvelopeVersion.Soap11)
     {
         return(SoapEnvelopeVersion.Soap11);
     }
     else if (version == EnvelopeVersion.Soap12)
     {
         return(SoapEnvelopeVersion.Soap12);
     }
     else
     {
         return(SoapEnvelopeVersion.None);
     }
 }
Esempio n. 18
0
        internal static SoapBodyBinding GetOrCreateSoapBodyBinding(WsdlEndpointConversionContext endpointContext, MessageBinding wsdlMessageBinding, WsdlExporter exporter)
        {
            if (GetSoapVersionState(endpointContext.WsdlBinding, exporter) == EnvelopeVersion.None)
            {
                return(null);
            }
            SoapBodyBinding soapBodyBinding = GetSoapBodyBinding(endpointContext, wsdlMessageBinding);
            EnvelopeVersion soapVersion     = GetSoapVersion(endpointContext.WsdlBinding);

            if (soapBodyBinding != null)
            {
                return(soapBodyBinding);
            }
            return(CreateSoapBodyBinding(soapVersion, wsdlMessageBinding));
        }
Esempio n. 19
0
        private static SoapAddressBinding CreateSoapAddressBinding(EnvelopeVersion version, Port wsdlPort)
        {
            SoapAddressBinding extension = null;

            if (version == EnvelopeVersion.Soap12)
            {
                extension = new Soap12AddressBinding();
            }
            else if (version == EnvelopeVersion.Soap11)
            {
                extension = new SoapAddressBinding();
            }
            wsdlPort.Extensions.Add(extension);
            return(extension);
        }
Esempio n. 20
0
        private static SoapBodyBinding CreateSoapBodyBinding(EnvelopeVersion version, MessageBinding wsdlMessageBinding)
        {
            SoapBodyBinding extension = null;

            if (version == EnvelopeVersion.Soap12)
            {
                extension = new Soap12BodyBinding();
            }
            else if (version == EnvelopeVersion.Soap11)
            {
                extension = new SoapBodyBinding();
            }
            wsdlMessageBinding.Extensions.Add(extension);
            return(extension);
        }
Esempio n. 21
0
        private static SoapOperationBinding CreateSoapOperationBinding(EnvelopeVersion version, OperationBinding wsdlOperationBinding)
        {
            SoapOperationBinding extension = null;

            if (version == EnvelopeVersion.Soap12)
            {
                extension = new Soap12OperationBinding();
            }
            else if (version == EnvelopeVersion.Soap11)
            {
                extension = new SoapOperationBinding();
            }
            wsdlOperationBinding.Extensions.Add(extension);
            return(extension);
        }
Esempio n. 22
0
        internal static SoapOperationBinding GetOrCreateSoapOperationBinding(WsdlEndpointConversionContext endpointContext, OperationDescription operation, WsdlExporter exporter)
        {
            if (GetSoapVersionState(endpointContext.WsdlBinding, exporter) == EnvelopeVersion.None)
            {
                return(null);
            }
            SoapOperationBinding soapOperationBinding = GetSoapOperationBinding(endpointContext, operation);
            OperationBinding     operationBinding     = endpointContext.GetOperationBinding(operation);
            EnvelopeVersion      soapVersion          = GetSoapVersion(endpointContext.WsdlBinding);

            if (soapOperationBinding != null)
            {
                return(soapOperationBinding);
            }
            return(CreateSoapOperationBinding(soapVersion, operationBinding));
        }
Esempio n. 23
0
        private EnvelopeVersion Parse(string value, EnvelopeVersion def)
        {
            if (value == null)
            {
                return(def);
            }

            switch (value.ToLowerInvariant())
            {
            case "soap11":  return(EnvelopeVersion.Soap11);

            case "soap12":  return(EnvelopeVersion.Soap12);

            default:        throw new ArgumentException(string.Format("Unknown WCF [EnvelopeVersion]: {0}", value));
            }
        }
Esempio n. 24
0
 internal static string GetEncoding(EnvelopeVersion version)
 {
     if (version == EnvelopeVersion.Soap11)
     {
         return(soap11Encoding);
     }
     else if (version == EnvelopeVersion.Soap12)
     {
         return(soap12Encoding);
     }
     else
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("version",
                                                                      SR.Format(SR.EnvelopeVersionNotSupported, version));
     }
 }
        static WsdlNS.SoapHeaderBinding CreateSoapHeaderBinding(EnvelopeVersion version, WsdlNS.MessageBinding wsdlMessageBinding)
        {
            WsdlNS.SoapHeaderBinding soapHeaderBinding = null;

            if (version == EnvelopeVersion.Soap12)
            {
                soapHeaderBinding = new WsdlNS.Soap12HeaderBinding();
            }
            else if (version == EnvelopeVersion.Soap11)
            {
                soapHeaderBinding = new WsdlNS.SoapHeaderBinding();
            }
            Fx.Assert(soapHeaderBinding != null, "EnvelopeVersion is not recognized. Please update the SoapHelper class");

            wsdlMessageBinding.Extensions.Add(soapHeaderBinding);
            return(soapHeaderBinding);
        }
        static void ApplyAddressingVersion(MessageEncodingBindingElement encodingBindingElement, AddressingVersion addressingVersion)
        {
            EnvelopeVersion defaultEnvelopeVersion = encodingBindingElement.MessageVersion.Envelope;

            if (defaultEnvelopeVersion == EnvelopeVersion.None &&
                addressingVersion != AddressingVersion.None)
            {
                // The default envelope version is None which incompatible with the
                // addressing version.
                // We replace it with soap12. This will be updated at wsdl import time if necessary.
                encodingBindingElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, addressingVersion);
            }
            else
            {
                encodingBindingElement.MessageVersion = MessageVersion.CreateVersion(defaultEnvelopeVersion, addressingVersion);
            }
        }
Esempio n. 27
0
        private static WsdlNS.SoapAddressBinding CreateSoapAddressBinding(EnvelopeVersion version, WsdlNS.Port wsdlPort)
        {
            WsdlNS.SoapAddressBinding soapAddressBinding = null;

            if (version == EnvelopeVersion.Soap12)
            {
                soapAddressBinding = new WsdlNS.Soap12AddressBinding();
            }
            else if (version == EnvelopeVersion.Soap11)
            {
                soapAddressBinding = new WsdlNS.SoapAddressBinding();
            }
            Fx.Assert(soapAddressBinding != null, "EnvelopeVersion is not recognized. Please update the SoapHelper class");

            wsdlPort.Extensions.Add(soapAddressBinding);
            return(soapAddressBinding);
        }
Esempio n. 28
0
        private static XmlElement CreateSoapFaultBinding(EnvelopeVersion version)
        {
            string prefix       = null;
            string namespaceURI = null;

            if (version == EnvelopeVersion.Soap12)
            {
                namespaceURI = "http://schemas.xmlsoap.org/wsdl/soap12/";
                prefix       = "soap12";
            }
            else if (version == EnvelopeVersion.Soap11)
            {
                namespaceURI = "http://schemas.xmlsoap.org/wsdl/soap/";
                prefix       = "soap";
            }
            return(Document.CreateElement(prefix, "fault", namespaceURI));
        }
Esempio n. 29
0
        protected override void OnWriteStartDetail(XmlDictionaryWriter writer, EnvelopeVersion version)
        {
            using (XmlReader r = _detail.GetReader(0))
            {
                // Start the element
                base.OnWriteStartDetail(writer, version);

                // Copy the attributes
                while (r.MoveToNextAttribute())
                {
                    if (ShouldWriteDetailAttribute(version, r.Prefix, r.LocalName, r.Value))
                    {
                        writer.WriteAttributeString(r.Prefix, r.LocalName, r.NamespaceURI, r.Value);
                    }
                }
            }
        }
        internal static WsdlNS.SoapBinding GetOrCreateSoapBinding(WsdlEndpointConversionContext endpointContext, WsdlExporter exporter)
        {
            if (GetSoapVersionState(endpointContext.WsdlBinding, exporter) == EnvelopeVersion.None)
            {
                return(null);
            }

            WsdlNS.SoapBinding existingSoapBinding = GetSoapBinding(endpointContext);
            if (existingSoapBinding != null)
            {
                return(existingSoapBinding);
            }

            EnvelopeVersion version = GetSoapVersion(endpointContext.WsdlBinding);

            WsdlNS.SoapBinding soapBinding = CreateSoapBinding(version, endpointContext.WsdlBinding);
            return(soapBinding);
        }
Esempio n. 31
0
 private MessageVersion(EnvelopeVersion envelopeVersion, AddressingVersion addressingVersion)
 {
     _envelope = envelopeVersion;
     _addressing = addressingVersion;
 }
Esempio n. 32
0
        public static MessageVersion CreateVersion(EnvelopeVersion envelopeVersion, AddressingVersion addressingVersion)
        {
            if (envelopeVersion == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("envelopeVersion");
            }

            if (addressingVersion == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("addressingVersion");
            }

            if (envelopeVersion == EnvelopeVersion.Soap12)
            {
                if (addressingVersion == AddressingVersion.WSAddressing10)
                {
                    return s_soap12Addressing10;
                }
                else if (addressingVersion == AddressingVersion.None)
                {
                    return s_soap12;
                }
                else
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("addressingVersion",
                        SR.Format(SR.AddressingVersionNotSupported, addressingVersion));
                }
            }
            else if (envelopeVersion == EnvelopeVersion.Soap11)
            {
                if (addressingVersion == AddressingVersion.WSAddressing10)
                {
                    return s_soap11Addressing10;
                }
                else if (addressingVersion == AddressingVersion.None)
                {
                    return s_soap11;
                }
                else
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("addressingVersion",
                        SR.Format(SR.AddressingVersionNotSupported, addressingVersion));
                }
            }
            else if (envelopeVersion == EnvelopeVersion.None)
            {
                if (addressingVersion == AddressingVersion.None)
                {
                    return s_none;
                }
                else
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("addressingVersion",
                        SR.Format(SR.AddressingVersionNotSupported, addressingVersion));
                }
            }
            else
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("envelopeVersion",
                    SR.Format(SR.EnvelopeVersionNotSupported, envelopeVersion));
            }
        }
 MessageVersion(EnvelopeVersion envelopeVersion, AddressingVersion addressingVersion)
 {
     this.envelope = envelopeVersion;
     this.addressing = addressingVersion;
 }
Esempio n. 34
0
 public static MessageVersion CreateVersion(EnvelopeVersion envelopeVersion)
 {
     return CreateVersion(envelopeVersion, AddressingVersion.WSAddressing10);
 }