protected virtual XmlReader GetReaderForMessage(SoapClientMessage message, int bufferSize)
        {
            Encoding enc = message.SoapVersion == SoapProtocolVersion.Soap12 ? RequestResponseUtils.GetEncoding2(message.ContentType) : RequestResponseUtils.GetEncoding(message.ContentType);

            if (bufferSize < 512)
            {
                bufferSize = 512;
            }
            XmlTextReader reader;

            if (enc != null)
            {
                reader = new XmlTextReader(new StreamReader(message.Stream, enc, true, bufferSize));
            }
            else
            {
                //
                reader = new XmlTextReader(message.Stream);
            }

            reader.DtdProcessing = DtdProcessing.Prohibit;
            reader.Normalization = true;
            reader.XmlResolver   = null;

            return(reader);
        }
예제 #2
0
        protected virtual XmlReader GetReaderForMessage(SoapClientMessage message, int bufferSize)
        {
            Encoding encoding = message.SoapVersion == SoapProtocolVersion.Soap12 ? RequestResponseUtils.GetEncoding2(message.ContentType) : RequestResponseUtils.GetEncoding(message.ContentType);

            if (bufferSize < 512)
            {
                bufferSize = 512;
            }
            XmlTextReader xmlTextReader = encoding == null ? new XmlTextReader(message.Stream) : new XmlTextReader((TextReader) new StreamReader(message.Stream, encoding, true, bufferSize));

            xmlTextReader.DtdProcessing = DtdProcessing.Prohibit;
            xmlTextReader.Normalization = true;
            xmlTextReader.XmlResolver   = (XmlResolver)null;
            return((XmlReader)xmlTextReader);
        }
예제 #3
0
        internal XmlReader GetXmlReader()
        {
            Encoding encoding = RequestResponseUtils.GetEncoding2(this.Message.ContentType);

            if (((((this.serverMethod != null) && ((this.serverMethod.wsiClaims & WsiProfiles.BasicProfile1_1) != WsiProfiles.None)) && (this.Version != SoapProtocolVersion.Soap12)) && (encoding != null)) && (!(encoding is UTF8Encoding) && !(encoding is UnicodeEncoding)))
            {
                throw new InvalidOperationException(System.Web.Services.Res.GetString("WebWsiContentTypeEncoding"));
            }
            XmlReader readerForMessage = this.GetReaderForMessage(this.Message, RequestResponseUtils.GetBufferSize(base.Request.ContentLength));

            if (readerForMessage == null)
            {
                throw new InvalidOperationException(System.Web.Services.Res.GetString("WebNullReaderForMessage"));
            }
            return(readerForMessage);
        }
예제 #4
0
        internal static XmlTextReader GetXmlTextReader(string contentType, Stream stream)
        {
            Encoding      enc = RequestResponseUtils.GetEncoding2(contentType);
            XmlTextReader reader;

            if (enc != null)
            {
                reader = new XmlTextReader(new StreamReader(stream, enc, true, 128));
            }
            else
            {
                reader = new XmlTextReader(stream);
            }
            reader.Normalization = true;
            reader.XmlResolver   = null;
            return(reader);
        }
예제 #5
0
        protected virtual XmlReader GetReaderForMessage(SoapServerMessage message, int bufferSize)
        {
            XmlTextReader reader;
            Encoding      encoding = RequestResponseUtils.GetEncoding2(message.ContentType);

            if (bufferSize < 0x200)
            {
                bufferSize = 0x200;
            }
            int  readTimeout = WebServicesSection.Current.SoapEnvelopeProcessing.ReadTimeout;
            long num2        = (readTimeout < 0) ? 0L : (readTimeout * 0x989680L);
            long ticks       = DateTime.UtcNow.Ticks;
            long timeout     = ((0x7fffffffffffffffL - num2) <= ticks) ? 0x7fffffffffffffffL : (ticks + num2);

            if (encoding != null)
            {
                if (timeout == 0x7fffffffffffffffL)
                {
                    reader = new XmlTextReader(new StreamReader(message.Stream, encoding, true, bufferSize));
                }
                else
                {
                    reader = new SoapEnvelopeReader(new StreamReader(message.Stream, encoding, true, bufferSize), timeout);
                }
            }
            else if (timeout == 0x7fffffffffffffffL)
            {
                reader = new XmlTextReader(message.Stream);
            }
            else
            {
                reader = new SoapEnvelopeReader(message.Stream, timeout);
            }
            reader.DtdProcessing = DtdProcessing.Prohibit;
            reader.Normalization = true;
            reader.XmlResolver   = null;
            return(reader);
        }