/// <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); }
/// <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); }
/// <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); }
public void DisposeReaderStreamSpy() { if (ReaderStreamSpy != null) { ReaderStreamSpy.Dispose(); ReaderStreamSpy = null; } }
public void DisposeWriterStreamSpy() { if (WriterStreamSpy != null) { WriterStreamSpy.Dispose(); WriterStreamSpy = null; } }
/// <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))); }
/// <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); }