【问题标题】:Customizing SOAP of WCF Web Service Reference自定义 WCF Web 服务参考的 SOAP
【发布时间】:2020-06-18 01:55:21
【问题描述】:

我在我的应用程序中使用自动生成的 WCF Web 服务参考将 SOAP 请求发送到远程主机。我面临的问题类似于此处描述的问题:Custom Message Formatting in WCF to add all Namespaces to the SOAP Envelope

本文中描述的解决方案我尝试使用来解决我的问题,但没有成功。 事情是看起来响应类必须从 Message 类继承。但就我而言,它是自动生成的。

我该怎么办?也许可以强制 svcutil 生成继承自 Message 的响应类?

【问题讨论】:

    标签: wcf serialization soap svcutil.exe


    【解决方案1】:

    您所指的类可能不是作者所说的 Message 类。使用Message InspectorMessage Formatter,我们可以拦截与服务器通信的SOAP 消息。
    请参考我在这些帖子中写的示例。
    How can I add a namespace to soap envelope in c#
    WCF Add Namespace Attributes
    与博客相反,我使用MessageInspector 截取SOAP 消息,而不是MessageFormatter。不过原理是一样的,都是使用WCF框架提供的接口实现来访问SOAP消息。当我们得到 SOAP 消息时,我们可以读取它并修改它。
    如果问题仍然存在,请随时告诉我。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-09
      • 2013-03-17
      • 1970-01-01
      • 1970-01-01
      • 2015-12-19
      • 1970-01-01
      相关资源
      最近更新 更多