Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 是否可以更改wcf Web服务的结果属性?_.net_Xml_Web Services_Soap_Methods - Fatal编程技术网

.net 是否可以更改wcf Web服务的结果属性?

.net 是否可以更改wcf Web服务的结果属性?,.net,xml,web-services,soap,methods,.net,Xml,Web Services,Soap,Methods,我对Soap服务器的响应方法有问题。 它是一个.net WCF Web服务 以下代码: [ServiceContract()] public interface IService1 { [OperationContract()] List<DealerLead> GetDealerLeads(List<DealerLeadsRequest> accountnummerString); } [ServiceContract()] 公共接口IService1

我对Soap服务器的响应方法有问题。 它是一个.net WCF Web服务

以下代码:

[ServiceContract()]
public interface IService1
{
    [OperationContract()]
    List<DealerLead> GetDealerLeads(List<DealerLeadsRequest> accountnummerString);
}
[ServiceContract()]
公共接口IService1
{
[运营合同()]
List GetDealReads(List accountnummerString);
}
将返回此文件:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <GetDealerLeadsResponse xmlns="http://tempuri.org/">
         <GetDealerLeadsResult xmlns:a="http://schemas.datacontract.org/2004/07/SoapTest"     xmlns:i="http://www.w3.org/2001/XMLSchema-instance">

但我如何才能将其更改为:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
  <GetDealerLeadsResponse xmlns="http://tempuri.org/">
     <AOtherMethodName xmlns:a="http://schemas.datacontract.org/2004/07/SoapTest" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">

因此,只需更改方法结果名称,WCF是否可以这样做


提前感谢

如果要控制SOAP操作的名称,可以使用

[OperationContract(Name = "AOtherMethodName")]

如果您真的想控制网络上消息的格式,您需要定义一个

Ok,使用名称param,我可以更改response属性,但它也更改了方法调用,它不是AOtherMethodName,而是aothermethodnamesult。如果属性中没有结果文本,是否可能?同样的问题,有什么方法可以做到吗?