我正在使用 Soap Web 服务并调用一个方法,我想获取实际的 xml 响应,有什么方法可以获取它吗?
最佳答案
警告:此建议有效,但由于不再支持 WSE 3.0,您可能需要查看 WCF。
通过使用 WSE 3.0,您可以管理通过 Web 服务客户端和服务器发送的 xml。为此,您需要更改 web.config 文件,将这些行添加到“配置”标记下的文件开头
<configSections>
<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</configSections>
然后在“/system.web”之后添加以下行:
<microsoft.web.services3>
<diagnostics>
<trace enabled="true" input="InputTrace.webinfo" output="OutputTrace.webinfo"/>
</diagnostics>
</microsoft.web.services3>
通过执行这些操作,您将获得包含 xml 格式的输入和输出 SOAP 消息的 InputTrace.webinfo 和 OutputTrace.webinfo 文件。
关于c# - 从 Soap WebService 获取实际响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3822526/