【问题标题】:how to add a parameter to soap body in wcf如何在 wcf 中向肥皂体添加参数
【发布时间】:2016-03-03 13:45:13
【问题描述】:

我们的客户希望使用以下肥皂消息来调用我的 WCF 服务:

<soapenv:Envelope .....>
<soapenv:Header />
<soapenv:Body>
  <st:myExtraParam>str ex</st:myExtraParam>
  <st:MyMethod>
    <st:myfuncParam>func str</st:myfuncParam> 
  </st:MyMethod>
  ....
  ....
</soapenv:Body>
</soapenv:Envelope>

我创建了如下服务合同:

[ServiceContract]
public interface IMyService
{
   [OperationContractAttribute]
   public ResponseObj MyMethod(string myfuncParam)
}

现在,如何在函数标签上方启用&lt;st:myExtraParam&gt;param str&lt;/st:myExtraParam&gt;参数?

【问题讨论】:

    标签: c# wcf soap servicecontract


    【解决方案1】:

    我的第一反应是,不能有多个 SOAP Body 元素的直接子元素。但是the SOAP specification 说这样做没问题。

    不过,我认为基于 [ServiceContract] 的 WCF 做不到。

    【讨论】:

    • 因为 SOAP 规范说我们可以在 SOAP Body 元素下使用多个子元素,所以我不能强迫我的客户不使用我的问题中描述的 XML。所以我还在努力寻找解决方案。
    猜你喜欢
    • 1970-01-01
    • 2010-12-30
    • 2013-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-14
    • 2018-04-12
    • 1970-01-01
    相关资源
    最近更新 更多