Web services 如何从WCF中的soap信封体中删除操作元素?
我有一个WCF服务设置,主要是根据客户的规格设置的,但是信封正文还需要一个额外的元素,我正试图根据客户的示例请求排除该元素 这些是我的服务和运营合同:Web services 如何从WCF中的soap信封体中删除操作元素?,web-services,wcf,soap,Web Services,Wcf,Soap,我有一个WCF服务设置,主要是根据客户的规格设置的,但是信封正文还需要一个额外的元素,我正试图根据客户的示例请求排除该元素 这些是我的服务和运营合同: [ServiceContract(Namespace="http://www.somenamespace.com")] public interface IProcessPayment { [OperationContract] ResponseSubmitPayment execute(RequestSubmitPayment
[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):
如何将WCF服务配置为不需要或排除该元素?客户告诉我,他们还有许多其他客户成功地测试和实施了它。SOAP1.1是我对他们发送内容的理解
提前谢谢 不确定在运营合同中是否可行。尝试使用消息契约,它将为您提供所需的灵活性。如果失败,请使用带有方法标志ParameterStyle=SoapParameterStyle.Bare的xmlserializer协定。不确定在operationcontract中是否可行。尝试使用消息协定,如果也不起作用,则使用带有方法标志ParameterStyle=SoapParameterStyle.com的xmlserializer协定!我要试一试@YaronNaveh请发布您的回复(特别是MessageContract)作为答案。为了澄清,MessageContract允许我做我需要的事情。@Zach我遇到了同样的问题,您能告诉我您是如何使用MessageContract的吗?@KevinBui Oh boy这是一段时间以前的事,但我相信我的最终解决方案有点不同。我想我采用了他们拥有的wsdl,并基于此生成了服务。它好得多/干净得多。
<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>