【发布时间】:2015-09-19 09:36:09
【问题描述】:
我有一个 WCF 服务设置,主要是根据客户的规范设置,但我试图根据客户的示例请求排除信封主体所需的一个额外元素。
这些是我的服务和运营合同:
[ServiceContract(Namespace="http://www.somenamespace.com")]
public interface IProcessPayment
{
[OperationContract]
ResponseSubmitPayment execute(RequestSubmitPayment RequestSubmitPayment);
}
这是他们发送来测试我的服务的内容:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pay="http://www.somenamespace.com">
<soapenv:Header/>
<soapenv:Body>
<pay:RequestSubmitPayment>
<!-- irrelevant stuff -->
</pay:RequestSubmitPayment>
</soapenv:Body>
</soapenv:Envelope>
这就是我的服务所期望的(基于 SOAPUI):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pay="http://www.somenamespace.com">
<soapenv:Header/>
<soapenv:Body>
<pay:execute> <!-- I want to remove this! -->
<pay:RequestSubmitPayment>
<!-- irrelevant stuff -->
</pay:RequestSubmitPayment>
</pay:execute> <!-- I want to remove this! -->
</soapenv:Body>
</soapenv:Envelope>
如何将我的 WCF 服务配置为不需要或排除该元素?客户告诉我,他们有许多其他客户成功地测试和实施了它。 SOAP 1.1 是我对他们发送的内容的理解。
提前致谢!
【问题讨论】:
-
不确定在操作合同中是否可行。尝试使用消息协定,如果也不起作用,则使用带有方法标志 ParameterStyle = SoapParameterStyle.Bare 的 xmlserializer 协定
-
看起来很有趣!我试试看!
-
@YaronNaveh 请发布您的回复(尤其是 MessageContract)作为答案。
标签: web-services wcf soap