.net 是否可以更改wcf Web服务的结果属性?
我对Soap服务器的响应方法有问题。 它是一个.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
[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。如果属性中没有结果文本,是否可能?同样的问题,有什么方法可以做到吗?