예제 #1
0
        /// <summary>Get Reader for Response</summary>
        protected override XmlReader GetReaderForMessage(SoapClientMessage message, int bufferSize)
        {
            DisposeReaderStreamSpy();
            var reader = SoapHttpClientSpy.GetReaderForMessage(message, bufferSize, CurrentWebRequest, out ReaderStreamSpy);

            return(reader);
        }
예제 #2
0
        /// <summary>Get Reader for Response</summary>
        public static XmlReader GetReaderForMessage(SoapClientMessage message, int bufferSize, HttpWebRequest request, out SoapHttpClientSpy readerStreamSpy)
        {
            readerStreamSpy = new SoapHttpClientSpy(message.Stream, request, true);
            Encoding encoding = null;
            // Set encoding.
            var charset = GetParameter(message.ContentType, "charset");

            if (!string.IsNullOrEmpty(charset))
            {
                encoding = Encoding.GetEncoding(charset);
            }
            if (encoding == null && !(message.SoapVersion == SoapProtocolVersion.Soap12 && IsApplication(message.ContentType)))
            {
                encoding = Encoding.ASCII;
            }
            if (bufferSize < 0x200)
            {
                bufferSize = 0x200;
            }
            var reader = encoding == null
                                ? new XmlTextReader(readerStreamSpy)
                                : new XmlTextReader(new StreamReader(readerStreamSpy, encoding, true, bufferSize));

            reader.DtdProcessing = DtdProcessing.Prohibit;
            reader.Normalization = true;
            reader.XmlResolver   = null;
            return(reader);
        }
예제 #3
0
        /// <summary>Get Writer for Request</summary>
        protected override XmlWriter GetWriterForMessage(SoapClientMessage message, int bufferSize)
        {
            DisposeWriterStreamSpy();
            var writer = SoapHttpClientSpy.GetWriterForMessage(message, bufferSize, base.RequestEncoding, CurrentWebRequest, out WriterStreamSpy);

            return(writer);
        }
예제 #4
0
 public void DisposeReaderStreamSpy()
 {
     if (ReaderStreamSpy != null)
     {
         ReaderStreamSpy.Dispose();
         ReaderStreamSpy = null;
     }
 }
예제 #5
0
 public void DisposeWriterStreamSpy()
 {
     if (WriterStreamSpy != null)
     {
         WriterStreamSpy.Dispose();
         WriterStreamSpy = null;
     }
 }
예제 #6
0
 /// <summary>Get Writer for Request</summary>
 public static XmlWriter GetWriterForMessage(SoapClientMessage message, int bufferSize, Encoding requestEncoding, HttpWebRequest request, out SoapHttpClientSpy writerStreamSpy)
 {
     writerStreamSpy = new SoapHttpClientSpy(message.Stream, request);
     if (bufferSize < 0x200)
     {
         bufferSize = 0x200;
     }
     return(new XmlTextWriter(new StreamWriter(writerStreamSpy, (requestEncoding != null) ? requestEncoding : new UTF8Encoding(false), bufferSize)));
 }
예제 #7
0
        /// <summary>Get Writer for Request</summary>
        protected override XmlWriter GetWriterForMessage(SoapClientMessage message, int bufferSize)
        {
            DisposeWriterStreamSpy();
            // Dispose reader too in case it was created by previous call.
            DisposeReaderStreamSpy();
            var writer = SoapHttpClientSpy.GetWriterForMessage(message, bufferSize, base.RequestEncoding, CurrentWebRequest, out WriterStreamSpy);

            return(writer);
        }