【发布时间】:2019-11-27 23:08:35
【问题描述】:
我创建了一个 SOAP WebService 来接收请求。我想用信封记录 SOAP 消息。 我发现了如何获取请求消息,但我没有发现如何获取回复消息。
为了获取 XML 请求,我使用下面的代码。
// Create array for holding request in bytes
byte[] inputStream = new byte[HttpContext.Current.Request.ContentLength];
// Read the entire request input stream
HttpContext.Current.Request.InputStream.Read(inputStream, 0, inputStream.Length);
// Set stream position back to beginning
HttpContext.Current.Request.InputStream.Position = 0;
// Get the XML request
string xmlRequestString = Encoding.UTF8.GetString(inputStream);
为了得到回复,我尝试在 Dispose 方法中执行此操作,但无法使其工作。
【问题讨论】:
-
当你说你不能让它工作时,发生了什么? inputStream 执行时的值是多少?
-
感谢您的尝试帮助。我发布了更多详细信息。