中的肥皂信封主体中删除操作元素

中的肥皂信封主体中删除操作元素

本文介绍了如何从 WCF 中的肥皂信封主体中删除操作元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 WCF 服务设置,主要是针对客户的规范,但我试图根据客户的示例请求排除一个信封正文所需的额外元素.

I have a WCF service setup mostly to a customer's spec, yet there is one extra element required of an envelope body that I'm trying to exclude based on the customer's sample request.

这些是我的服务和运营合同:

These are my service and operation contracts:

[ServiceContract(Namespace="http://www.somenamespace.com")]
public interface IProcessPayment
{
    [OperationContract]
    ResponseSubmitPayment execute(RequestSubmitPayment RequestSubmitPayment);
}

这是他们发送来测试我的服务的内容:

This is what they are sending to test my service with:

<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):

and this is what my service expects (based on 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 是我对他们发送的内容的理解.

How can I configure my WCF service to not require or exclude that element? The client has told me they have many other customers with it successfully tested and implemented. SOAP 1.1 is my understanding of what they're sending.

提前致谢!

推荐答案

不确定它在操作合同中是否可行.尝试使用消息合约,它将为您提供所需的灵活性.如果失败,请使用带有方法标志 ParameterStyle = SoapParameterStyle.Bare 的 xmlserializer 合同.

Not sure it is doable in operationcontract. Try using a message contract, it will give you the flexibility you need. If that fails use an xmlserializer contract with method flag ParameterStyle = SoapParameterStyle.Bare.

这篇关于如何从 WCF 中的肥皂信封主体中删除操作元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 19:22