static void EnsureMessageEncoding(WsdlEndpointConversionContext context, MessageEncodingBindingElement encodingBindingElement)
        {
            EnvelopeVersion   soapVersion = SoapHelper.GetSoapVersion(context.WsdlBinding);
            AddressingVersion addressingVersion;

            if (encodingBindingElement == null)
            {
                encodingBindingElement = new TextMessageEncodingBindingElement();
                ConvertToCustomBinding(context).Elements.Add(encodingBindingElement);

                addressingVersion = AddressingVersion.None;
            }
            else
            {
                if (soapVersion == EnvelopeVersion.None)
                {
                    addressingVersion = AddressingVersion.None;
                }
                else
                {
                    addressingVersion = encodingBindingElement.MessageVersion.Addressing;
                }
            }

            MessageVersion newMessageVersion = MessageVersion.CreateVersion(soapVersion, addressingVersion);

            if (!encodingBindingElement.MessageVersion.IsMatch(newMessageVersion))
            {
                ConvertToCustomBinding(context).Elements.Find <MessageEncodingBindingElement>().MessageVersion
                    = MessageVersion.CreateVersion(soapVersion, addressingVersion);
            }
        }
Пример #2
0
 public BinaryMessageEncodingBindingElement()
 {
     _maxReadPoolSize  = EncoderDefaults.MaxReadPoolSize;
     _maxWritePoolSize = EncoderDefaults.MaxWritePoolSize;
     _readerQuotas     = new XmlDictionaryReaderQuotas();
     EncoderDefaults.ReaderQuotas.CopyTo(_readerQuotas);
     _maxSessionSize    = BinaryEncoderDefaults.MaxSessionSize;
     _binaryVersion     = BinaryEncoderDefaults.BinaryVersion;
     _messageVersion    = MessageVersion.CreateVersion(BinaryEncoderDefaults.EnvelopeVersion);
     _compressionFormat = EncoderDefaults.DefaultCompressionFormat;
 }
        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);
            }
        }
        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);
            }
        }