/// <summary>
        /// Initializes a new instance.
        /// </summary>
        public TextOrMtomEncoder(MessageVersion messageVersion, XmlDictionaryReaderQuotas readerQuotas, int maxReadPoolSize, int maxWritePoolSize, int maxBufferSize)
        {
            if (messageVersion is null)
            {
                throw new ArgumentNullException(nameof(messageVersion));
            }
            if (readerQuotas is null)
            {
                throw new ArgumentNullException(nameof(readerQuotas));
            }

            var textEncoderBindingElement = new TextMessageEncodingBindingElement(messageVersion, Encoding.UTF8);

            textEncoderBindingElement.MaxReadPoolSize  = maxReadPoolSize;
            textEncoderBindingElement.MaxWritePoolSize = maxWritePoolSize;
            readerQuotas.CopyTo(textEncoderBindingElement.ReaderQuotas);
            text = textEncoderBindingElement.CreateMessageEncoderFactory().Encoder;

            if (messageVersion.Envelope != EnvelopeVersion.None)
            {
                var mtomEncoderBindingElement = new MtomMessageEncodingBindingElement(messageVersion, Encoding.UTF8);
                mtomEncoderBindingElement.MaxBufferSize    = maxBufferSize;
                mtomEncoderBindingElement.MaxReadPoolSize  = maxReadPoolSize;
                mtomEncoderBindingElement.MaxWritePoolSize = maxWritePoolSize;
                readerQuotas.CopyTo(mtomEncoderBindingElement.ReaderQuotas);
                mtom = mtomEncoderBindingElement.CreateMessageEncoderFactory().Encoder;
            }
        }
Exemplo n.º 2
0
        public XmlDictionaryWriter OpenSection(XmlDictionaryReaderQuotas quotas)
        {
            if (_bufferState != BufferState.Created)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateInvalidStateException());
            }
            _bufferState = BufferState.Writing;
            _quotas      = new XmlDictionaryReaderQuotas();
            quotas.CopyTo(_quotas);
            if (_writer != null)

            {
                // We always want to Dispose of the writer now; previously, writers could be reassigned

                // to a new stream, with a new dictionary and session.

                var thisWriter = _writer;

                thisWriter.Dispose();

                _writer = null;
            }

            _writer = XmlDictionaryWriter.CreateBinaryWriter(_stream, XD.Dictionary, null, true);
            return(_writer);
        }
Exemplo n.º 3
0
 public MtomMessageEncoder(System.ServiceModel.Channels.MessageVersion version, Encoding writeEncoding, int maxReadPoolSize, int maxWritePoolSize, int maxBufferSize, XmlDictionaryReaderQuotas quotas)
 {
     if (version == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("version");
     }
     if (writeEncoding == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writeEncoding");
     }
     TextEncoderDefaults.ValidateEncoding(writeEncoding);
     this.writeEncoding    = writeEncoding;
     this.maxReadPoolSize  = maxReadPoolSize;
     this.maxWritePoolSize = maxWritePoolSize;
     this.readerQuotas     = new XmlDictionaryReaderQuotas();
     quotas.CopyTo(this.readerQuotas);
     this.maxBufferSize         = maxBufferSize;
     this.onStreamedReaderClose = new OnXmlDictionaryReaderClose(this.ReturnStreamedReader);
     this.thisLock = new object();
     if (version.Envelope == EnvelopeVersion.Soap12)
     {
         this.contentEncodingMap = TextMessageEncoderFactory.Soap12Content;
     }
     else
     {
         if (version.Envelope != EnvelopeVersion.Soap11)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Invalid MessageVersion", new object[0])));
         }
         this.contentEncodingMap = TextMessageEncoderFactory.Soap11Content;
     }
     this.version = version;
 }
Exemplo n.º 4
0
        public MtomMessageEncoder(MessageVersion version, Encoding writeEncoding, int maxReadPoolSize, int maxWritePoolSize, int maxBufferSize, XmlDictionaryReaderQuotas quotas, MtomMessageEncoderFactory factory)
        {
            if (version == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(version));
            }
            if (writeEncoding == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(writeEncoding));
            }

            _factory = factory;
            TextEncoderDefaults.ValidateEncoding(writeEncoding);
            _writeEncoding = writeEncoding;

            MaxReadPoolSize  = maxReadPoolSize;
            MaxWritePoolSize = maxWritePoolSize;

            ReaderQuotas = new XmlDictionaryReaderQuotas();
            quotas.CopyTo(ReaderQuotas);

            _bufferedReadReaderQuotas = EncoderHelpers.GetBufferedReadQuotas(ReaderQuotas);
            MaxBufferSize             = maxBufferSize;
            _version     = version;
            _contentType = GetContentType(out _boundary);
        }
            public JsonMessageEncoder(Encoding writeEncoding, int maxReadPoolSize, int maxWritePoolSize, XmlDictionaryReaderQuotas quotas, bool crossDomainScriptAccessEnabled)
            {
                if (writeEncoding == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writeEncoding");
                }

                thisLock = new object();

                TextEncoderDefaults.ValidateEncoding(writeEncoding);
                this.writeEncoding = writeEncoding;

                this.maxReadPoolSize  = maxReadPoolSize;
                this.maxWritePoolSize = maxWritePoolSize;

                this.readerQuotas          = new XmlDictionaryReaderQuotas();
                this.onStreamedReaderClose = new OnXmlDictionaryReaderClose(ReturnStreamedReader);
                quotas.CopyTo(this.readerQuotas);

                this.bufferedReadReaderQuotas = EncoderHelpers.GetBufferedReadQuotas(this.readerQuotas);

                this.contentType = WebMessageEncoderFactory.GetContentType(JsonGlobals.applicationJsonMediaType, writeEncoding);
                this.crossDomainScriptAccessEnabled = crossDomainScriptAccessEnabled;
                this.encodedClosingFunctionCall     = this.writeEncoding.GetBytes(");");
            }
 public PeerNodeConfig(string meshId, ulong nodeId, PeerResolver resolver, PeerMessagePropagationFilter messagePropagationFilter, System.ServiceModel.Channels.MessageEncoder encoder, Uri listenUri, IPAddress listenIPAddress, int port, long maxReceivedMessageSize, int minNeighbors, int idealNeighbors, int maxNeighbors, int maxReferrals, int connectTimeout, int maintainerInterval, PeerSecurityManager securityManager, XmlDictionaryReaderQuotas readerQuotas, long maxBufferPool, int maxSendQueueSize, int maxReceiveQueueSize)
 {
     this.connectTimeout         = connectTimeout;
     this.listenIPAddress        = listenIPAddress;
     this.listenUri              = listenUri;
     this.maxReceivedMessageSize = maxReceivedMessageSize;
     this.minNeighbors           = minNeighbors;
     this.idealNeighbors         = idealNeighbors;
     this.maxNeighbors           = maxNeighbors;
     this.maxReferrals           = maxReferrals;
     this.maxReferralCacheSize   = 50;
     this.maxResolveAddresses    = 3;
     this.meshId  = meshId;
     this.encoder = encoder;
     this.messagePropagationFilter = messagePropagationFilter;
     this.nodeId                  = nodeId;
     this.port                    = port;
     this.resolver                = resolver;
     this.maintainerInterval      = maintainerInterval;
     this.maintainerRetryInterval = new TimeSpan(0x5f5e100L);
     this.maintainerTimeout       = new TimeSpan(0x47868c00L);
     this.unregisterTimeout       = new TimeSpan(0x47868c00L);
     this.securityManager         = securityManager;
     readerQuotas.CopyTo(this.readerQuotas);
     this.maxBufferPoolSize          = maxBufferPool;
     this.maxIncomingConcurrentCalls = maxReceiveQueueSize;
     this.maxSendQueueSize           = maxSendQueueSize;
 }
Exemplo n.º 7
0
        internal static XmlDictionaryReaderQuotas GetBufferedReadQuotas(XmlDictionaryReaderQuotas encoderQuotas)
        {
            XmlDictionaryReaderQuotas bufferedReadQuotas = new XmlDictionaryReaderQuotas();

            encoderQuotas.CopyTo(bufferedReadQuotas);

            // now we have the quotas from the encoder, we need to update the values with the new quotas from the default read quotas.
            if (IsDefaultQuota(bufferedReadQuotas, XmlDictionaryReaderQuotaTypes.MaxStringContentLength))
            {
                bufferedReadQuotas.MaxStringContentLength = EncoderDefaults.BufferedReadDefaultMaxStringContentLength;
            }

            if (IsDefaultQuota(bufferedReadQuotas, XmlDictionaryReaderQuotaTypes.MaxArrayLength))
            {
                bufferedReadQuotas.MaxArrayLength = EncoderDefaults.BufferedReadDefaultMaxArrayLength;
            }

            if (IsDefaultQuota(bufferedReadQuotas, XmlDictionaryReaderQuotaTypes.MaxBytesPerRead))
            {
                bufferedReadQuotas.MaxBytesPerRead = EncoderDefaults.BufferedReadDefaultMaxBytesPerRead;
            }

            if (IsDefaultQuota(bufferedReadQuotas, XmlDictionaryReaderQuotaTypes.MaxNameTableCharCount))
            {
                bufferedReadQuotas.MaxNameTableCharCount = EncoderDefaults.BufferedReadDefaultMaxNameTableCharCount;
            }

            if (IsDefaultQuota(bufferedReadQuotas, XmlDictionaryReaderQuotaTypes.MaxDepth))
            {
                bufferedReadQuotas.MaxDepth = EncoderDefaults.BufferedReadDefaultMaxDepth;
            }

            return(bufferedReadQuotas);
        }
        public override BindingElementCollection CreateBindingElements()
        {
            BinaryMessageEncodingBindingElement be =
                new BinaryMessageEncodingBindingElement();

            quotas.CopyTo(be.ReaderQuotas);
            MsmqTransportBindingElement te =
                new MsmqTransportBindingElement();

            te.MaxPoolSize           = (int)MaxBufferPoolSize;
            te.QueueTransferProtocol = QueueTransferProtocol;
            te.UseActiveDirectory    = UseActiveDirectory;
            te.CustomDeadLetterQueue = CustomDeadLetterQueue;
            te.DeadLetterQueue       = DeadLetterQueue;
            te.Durable                = Durable;
            te.ExactlyOnce            = ExactlyOnce;
            te.MaxReceivedMessageSize = MaxReceivedMessageSize;
            te.MaxRetryCycles         = MaxRetryCycles;
            te.MsmqTransportSecurity.MsmqAuthenticationMode  = Security.Transport.MsmqAuthenticationMode;
            te.MsmqTransportSecurity.MsmqEncryptionAlgorithm = Security.Transport.MsmqEncryptionAlgorithm;
            te.MsmqTransportSecurity.MsmqProtectionLevel     = Security.Transport.MsmqProtectionLevel;
            te.MsmqTransportSecurity.MsmqSecureHashAlgorithm = Security.Transport.MsmqSecureHashAlgorithm;
            te.ReceiveErrorHandling = ReceiveErrorHandling;
            te.ReceiveRetryCount    = ReceiveRetryCount;
            te.RetryCycleDelay      = RetryCycleDelay;
            te.TimeToLive           = TimeToLive;
            te.UseMsmqTracing       = UseMsmqTracing;
            te.UseSourceJournal     = UseSourceJournal;

            return(new BindingElementCollection(new BindingElement [] { be, te }));
        }
 public WebScriptMetadataMessageEncoder(XmlDictionaryReaderQuotas quotas)
 {
     this.readerQuotas = new XmlDictionaryReaderQuotas();
     quotas.CopyTo(this.readerQuotas);
     this.mediaType = this.contentType = applicationJavaScriptMediaType;
     this.innerReadMessageEncoder = new TextMessageEncodingBindingElement(MessageVersion.None, Encoding.UTF8).CreateMessageEncoderFactory().Encoder;
 }
Exemplo n.º 10
0
 public RawMessageEncoder(XmlDictionaryReaderQuotas quotas)
 {
     this.readerQuotas = new XmlDictionaryReaderQuotas();
     if (quotas != null)
     {
         quotas.CopyTo(this.readerQuotas);
     }
 }
 public ByteStreamMessageEncodingBindingElement(XmlDictionaryReaderQuotas quota)
 {
     this.readerQuotas = new XmlDictionaryReaderQuotas();
     if (quota != null)
     {
         quota.CopyTo(this.readerQuotas);
     }
 }
Exemplo n.º 12
0
        bool moveBodyReaderToContent = false; // false because we want the ByteStreamMessageEncoder to be compatible with previous releases

        public ByteStreamMessageEncoder(XmlDictionaryReaderQuotas quotas)
        {
            this.quotas = new XmlDictionaryReaderQuotas();
            quotas.CopyTo(this.quotas);

            this.bufferedReadReaderQuotas = EncoderHelpers.GetBufferedReadQuotas(this.quotas);

            this.maxSentMessageSizeExceededResourceString     = SR.MaxSentMessageSizeExceeded("{0}");
            this.maxReceivedMessageSizeExceededResourceString = SR.MaxReceivedMessageSizeExceeded("{0}");
        }
Exemplo n.º 13
0
 public RawMessageBuffer(MessageHeaders headers, MessageProperties properties, byte[] bytes, int index, int count, XmlDictionaryReaderQuotas quotas)
     : base()
 {
     this.headers      = new MessageHeaders(headers);
     this.properties   = new MessageProperties(properties);
     this.bodyBytes    = bytes;
     this.index        = index;
     this.count        = count;
     this.readerQuotas = new XmlDictionaryReaderQuotas();
     quotas.CopyTo(this.readerQuotas);
 }
Exemplo n.º 14
0
                public ByteStreamMessageBuffer(ByteStreamBufferedMessageData messageData, MessageHeaders headers, MessageProperties properties, XmlDictionaryReaderQuotas quotas, bool moveBodyReaderToContent)
                    : base()
                {
                    this.messageData = messageData;
                    this.headers     = new MessageHeaders(headers);
                    this.properties  = new MessageProperties(properties);
                    this.quotas      = new XmlDictionaryReaderQuotas();
                    quotas.CopyTo(this.quotas);
                    this.moveBodyReaderToContent = moveBodyReaderToContent;

                    this.messageData.Open();
                }
Exemplo n.º 15
0
    public static void ReaderQuotas_Property_Sets()
    {
        var binding = new BasicHttpBinding();

        XmlDictionaryReaderQuotas maxQuota     = XmlDictionaryReaderQuotas.Max;
        XmlDictionaryReaderQuotas defaultQuota = new XmlDictionaryReaderQuotas();

        Assert.True(TestHelpers.XmlDictionaryReaderQuotasAreEqual(binding.ReaderQuotas, defaultQuota));

        maxQuota.CopyTo(binding.ReaderQuotas);
        Assert.True(TestHelpers.XmlDictionaryReaderQuotasAreEqual(binding.ReaderQuotas, maxQuota), "Setting Max ReaderQuota failed");
    }
Exemplo n.º 16
0
        public XmlDictionaryWriter OpenSection(XmlDictionaryReaderQuotas quotas)
        {
            if (_bufferState != BufferState.Created)
            {
                throw CreateInvalidStateException();
            }
            _bufferState = BufferState.Writing;
            _quotas      = new XmlDictionaryReaderQuotas();
            quotas.CopyTo(_quotas);

            _writer = XmlDictionaryWriter.CreateBinaryWriter(_stream, null, null, false);

            return(_writer);
        }
            public TextMessageEncoder(MessageVersion version, Encoding writeEncoding, int maxReadPoolSize, int maxWritePoolSize, XmlDictionaryReaderQuotas quotas)
            {
                if (version == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("version");
                }
                if (writeEncoding == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writeEncoding");
                }

                TextEncoderDefaults.ValidateEncoding(writeEncoding);
                this.writeEncoding   = writeEncoding;
                optimizeWriteForUTF8 = IsUTF8Encoding(writeEncoding);

                thisLock = new object();

                this.version          = version;
                this.maxReadPoolSize  = maxReadPoolSize;
                this.maxWritePoolSize = maxWritePoolSize;

                this.readerQuotas = new XmlDictionaryReaderQuotas();
                quotas.CopyTo(this.readerQuotas);

                this.bufferedReadReaderQuotas = EncoderHelpers.GetBufferedReadQuotas(this.readerQuotas);

                this.onStreamedReaderClose = new OnXmlDictionaryReaderClose(ReturnStreamedReader);

                this.mediaType   = TextMessageEncoderFactory.GetMediaType(version);
                this.contentType = TextMessageEncoderFactory.GetContentType(mediaType, writeEncoding);
                if (version.Envelope == EnvelopeVersion.Soap12)
                {
                    contentEncodingMap = TextMessageEncoderFactory.Soap12Content;
                }
                else if (version.Envelope == EnvelopeVersion.Soap11)
                {
                    contentEncodingMap = TextMessageEncoderFactory.Soap11Content;
                }
                else if (version.Envelope == EnvelopeVersion.None)
                {
                    contentEncodingMap = TextMessageEncoderFactory.SoapNoneContent;
                }
                else
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(
                                                                                  SR.GetString(SR.EnvelopeVersionNotSupported, version.Envelope)));
                }
            }
 public BinaryMessageEncoderFactory(System.ServiceModel.Channels.MessageVersion messageVersion, int maxReadPoolSize, int maxWritePoolSize, int maxSessionSize, XmlDictionaryReaderQuotas readerQuotas, BinaryVersion version)
 {
     this.messageVersion        = messageVersion;
     this.messageEncoder        = new BinaryMessageEncoder(this, false, 0);
     this.maxReadPoolSize       = maxReadPoolSize;
     this.maxWritePoolSize      = maxWritePoolSize;
     this.maxSessionSize        = maxSessionSize;
     this.thisLock              = new object();
     this.onStreamedReaderClose = new OnXmlDictionaryReaderClose(this.ReturnStreamedReader);
     this.readerQuotas          = new XmlDictionaryReaderQuotas();
     if (readerQuotas != null)
     {
         readerQuotas.CopyTo(this.readerQuotas);
     }
     this.binaryVersion = version;
 }
Exemplo n.º 19
0
            public TextMessageEncoder(MessageVersion version, Encoding writeEncoding, int maxReadPoolSize, int maxWritePoolSize, XmlDictionaryReaderQuotas quotas)
            {
                if (version == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("version");
                }
                if (writeEncoding == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writeEncoding");
                }

                TextEncoderDefaults.ValidateEncoding(writeEncoding);
                _writeEncoding        = writeEncoding;
                _optimizeWriteForUTF8 = IsUTF8Encoding(writeEncoding);

                _thisLock = new object();

                _version          = version;
                _maxReadPoolSize  = maxReadPoolSize;
                _maxWritePoolSize = maxWritePoolSize;

                _readerQuotas = new XmlDictionaryReaderQuotas();
                quotas.CopyTo(_readerQuotas);
                _bufferedReadReaderQuotas = EncoderHelpers.GetBufferedReadQuotas(_readerQuotas);

                _mediaType   = TextMessageEncoderFactory.GetMediaType(version);
                _contentType = TextMessageEncoderFactory.GetContentType(_mediaType, writeEncoding);
                if (version.Envelope == EnvelopeVersion.Soap12)
                {
                    _contentEncodingMap = TextMessageEncoderFactory.Soap12Content;
                }
                else if (version.Envelope == EnvelopeVersion.Soap11)
                {
                    // public profile does not allow SOAP1.1/WSA1.0. However, the EnvelopeVersion 1.1 is supported. Need to know what the implications are here
                    // but I think that it's not necessary to have here since we're a sender in N only.
                    _contentEncodingMap = TextMessageEncoderFactory.Soap11Content;
                }
                else if (version.Envelope == EnvelopeVersion.None)
                {
                    _contentEncodingMap = TextMessageEncoderFactory.SoapNoneContent;
                }
                else
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(
                                                                                  string.Format(SRServiceModel.EnvelopeVersionNotSupported, version.Envelope)));
                }
            }
Exemplo n.º 20
0
            public TextMessageEncoder(MessageVersion version, Encoding writeEncoding, int maxReadPoolSize, int maxWritePoolSize, XmlDictionaryReaderQuotas quotas)
            {
                if (writeEncoding == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(writeEncoding));
                }

                TextEncoderDefaults.ValidateEncoding(writeEncoding);
                _writeEncoding        = writeEncoding;
                _optimizeWriteForUTF8 = IsUTF8Encoding(writeEncoding);

                ThisLock = new object();

                _version         = version ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(version));
                MaxReadPoolSize  = maxReadPoolSize;
                MaxWritePoolSize = maxWritePoolSize;

                ReaderQuotas = new XmlDictionaryReaderQuotas();
                quotas.CopyTo(ReaderQuotas);

                _bufferedReadReaderQuotas = EncoderHelpers.GetBufferedReadQuotas(ReaderQuotas);

                _onStreamedReaderClose = new OnXmlDictionaryReaderClose(ReturnStreamedReader);

                _mediaType   = GetMediaType(version);
                _contentType = GetContentType(_mediaType, writeEncoding);
                if (version.Envelope == EnvelopeVersion.Soap12)
                {
                    _contentEncodingMap = Soap12Content;
                }
                else if (version.Envelope == EnvelopeVersion.Soap11)
                {
                    _contentEncodingMap = Soap11Content;
                }
                else if (version.Envelope == EnvelopeVersion.None)
                {
                    _contentEncodingMap = SoapNoneContent;
                }
                else
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(
                                                                                  SR.Format(SR.EnvelopeVersionNotSupported, version.Envelope)));
                }
            }
Exemplo n.º 21
0
 public XmlDictionaryWriter OpenSection(XmlDictionaryReaderQuotas quotas)
 {
     if (bufferState != BufferState.Created)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateInvalidStateException());
     }
     bufferState = BufferState.Writing;
     this.quotas = new XmlDictionaryReaderQuotas();
     quotas.CopyTo(this.quotas);
     if (this.writer == null)
     {
         this.writer = XmlDictionaryWriter.CreateBinaryWriter(stream, XD.Dictionary, null, true);
     }
     else
     {
         ((IXmlBinaryWriterInitializer)this.writer).SetOutput(stream, XD.Dictionary, null, true);
     }
     return(this.writer);
 }
Exemplo n.º 22
0
        protected override void OnOpening()
        {
            var readerQuotas = new XmlDictionaryReaderQuotas();

            readerQuotas.MaxStringContentLength = int.MaxValue;

            base.OnOpening();

            // change readerQuotas

            foreach (var ep in this.Description.Endpoints)
            {
                var binding = new CustomBinding(ep.Binding);

                readerQuotas.CopyTo(binding.Elements.Find <WebMessageEncodingBindingElement>().ReaderQuotas);

                ep.Binding = binding;
            }
        }
Exemplo n.º 23
0
            public WebMessageEncoder(Encoding writeEncoding, int maxReadPoolSize, int maxWritePoolSize, XmlDictionaryReaderQuotas quotas, WebContentTypeMapper contentTypeMapper, bool javascriptCallbackEnabled)
            {
                if (writeEncoding == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writeEncoding");
                }

                this.thisLock = new object();

                TextEncoderDefaults.ValidateEncoding(writeEncoding);
                this.writeEncoding = writeEncoding;

                this.maxReadPoolSize           = maxReadPoolSize;
                this.maxWritePoolSize          = maxWritePoolSize;
                this.contentTypeMapper         = contentTypeMapper;
                this.javascriptCallbackEnabled = javascriptCallbackEnabled;

                this.readerQuotas = new XmlDictionaryReaderQuotas();
                quotas.CopyTo(this.readerQuotas);

                this.defaultContentType = GetContentType(defaultMediaType, writeEncoding);
            }
Exemplo n.º 24
0
        public SoapMessageEncoder(MessageVersion version, Encoding writeEncoding, XmlDictionaryReaderQuotas quotas)
        {
            if (writeEncoding == null)
            {
                throw new ArgumentNullException(nameof(writeEncoding));
            }

            SoapMessageEncoderDefaults.ValidateEncoding(writeEncoding);

            _writeEncoding        = writeEncoding;
            _optimizeWriteForUtf8 = IsUtf8Encoding(writeEncoding);

            MessageVersion = version ?? throw new ArgumentNullException(nameof(version));

            MessageVersion = version;

            ReaderQuotas = new XmlDictionaryReaderQuotas();
            quotas.CopyTo(ReaderQuotas);

            MediaType   = GetMediaType(version);
            ContentType = GetContentType(MediaType, writeEncoding);
        }
Exemplo n.º 25
0
 internal override void SetReaderQuotas(XmlDictionaryReaderQuotas readerQuotas)
 {
     readerQuotas.CopyTo(_binaryMessageEncodingBindingElement.ReaderQuotas);
 }