WCF服务SOAP对象

时间:2017-09-07 14:27:33

标签: c# wcf soap

我在WCF中有一个Web服务,我的示例方法的合同/接口如下所示:

[ServiceContract]
public interface INTERFACE
{
    [OperationContract]
    os_consultar oe_consultar(oe_consultar obj_consultar);
}

此方法生成和XML一样:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org soap/envelope/" xmlns:wses="http://org.com/wses/"
xmlns:ean="http://schemas.datacontract.org/2004/07 Ean.PaymentGateway.Bank.BankInterfaceEntity">
<soapenv:Header/>
<soapenv:Body>
  <wses:oe_consultar>
     <!--Optional:-->
     <wses:obj_consultar>
        <cod1>?</cod1>
        <cod2>?</cod2>
     </wses:obj_consultar>
  </wses:oe_consultar>
 </soapenv:Body>
</soapenv:Envelope>

我想知道是否可以这样生成xml:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org soap/envelope/" xmlns:wses="http://org.com/wses/"
xmlns:ean="http://schemas.datacontract.org/2004/07 Ean.PaymentGateway.Bank.BankInterfaceEntity">
<soapenv:Header/>
<soapenv:Body>
  <wses:oe_consultar>
    <cod1>?</cod1>
    <cod2>?</cod2>
  </wses:oe_consultar>
 </soapenv:Body>
</soapenv:Envelope>

提前致谢

1 个答案:

答案 0 :(得分:0)

这个怎么样

[ServiceContract]
public interface INTERFACE
{
    [OperationContract]
    void oe_consultar(cod1 string, cod2 string);
}