protected override void OnWriteStartHeader(XmlDictionaryWriter writer, MessageVersion messageVersion)
 {
     if (!this.IsMessageVersionSupported(messageVersion))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("MessageHeaderVersionNotSupported", new object[] { base.GetType().FullName, messageVersion.ToString() }), "version"));
     }
     XmlDictionaryReader headerReader = this.GetHeaderReader();
     writer.WriteStartElement(headerReader.Prefix, headerReader.LocalName, headerReader.NamespaceURI);
     writer.WriteAttributes(headerReader, false);
     headerReader.Close();
 }
示例#2
0
        protected override void OnWriteStartHeader(XmlDictionaryWriter writer, MessageVersion messageVersion)
        {
            if (!IsMessageVersionSupported(messageVersion))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.Format(SR.MessageHeaderVersionNotSupported, this.GetType().FullName, messageVersion.ToString()), "version"));
            }
            XmlDictionaryReader reader = GetHeaderReader();

            writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
            writer.WriteAttributes(reader, false);
            reader.Dispose();
        }
示例#3
0
        public MtomMessageEncodingBindingElement(MessageVersion messageVersion, Encoding writeEncoding)
        {
            if (messageVersion == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("messageVersion");
            }

            if (messageVersion == MessageVersion.None)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(string.Format(SRServiceModel.MtomEncoderBadMessageVersion, messageVersion.ToString()), "messageVersion"));
            }

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

            TextEncoderDefaults.ValidateEncoding(writeEncoding);
            _maxReadPoolSize  = EncoderDefaults.MaxReadPoolSize;
            _maxWritePoolSize = EncoderDefaults.MaxWritePoolSize;
            _readerQuotas     = new XmlDictionaryReaderQuotas();
            EncoderDefaults.ReaderQuotas.CopyTo(_readerQuotas);
            _maxBufferSize  = MtomEncoderDefaults.MaxBufferSize;
            _messageVersion = messageVersion;
            _writeEncoding  = writeEncoding;
        }
 protected override void OnWriteStartHeader(XmlDictionaryWriter writer, MessageVersion messageVersion)
 {
     if (!IsMessageVersionSupported(messageVersion))
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.Format(SR.MessageHeaderVersionNotSupported, this.GetType().FullName, messageVersion.ToString()), "version"));
     XmlDictionaryReader reader = GetHeaderReader();
     writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
     writer.WriteAttributes(reader, false);
     reader.Dispose();
 }
        protected override void OnWriteStartHeader(XmlDictionaryWriter writer, MessageVersion messageVersion)
        {
            if (!this.IsMessageVersionSupported(messageVersion))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("MessageHeaderVersionNotSupported", new object[] { base.GetType().FullName, messageVersion.ToString() }), "version"));
            }
            XmlDictionaryReader headerReader = this.GetHeaderReader();

            writer.WriteStartElement(headerReader.Prefix, headerReader.LocalName, headerReader.NamespaceURI);
            writer.WriteAttributes(headerReader, false);
            headerReader.Close();
        }