I have a problem with the response method of the Soap serve开发者_开发问答r. It is a .net WCF webservice
The following code:
[ServiceContract()]
public interface IService1
{
[OperationContract()]
List<DealerLead> GetDealerLeads(List<DealerLeadsRequest> accountnummerString);
}
Will return this:
<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">
But how can i change it to this:
<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">
So only the method result name must be changed, is this possible with WCF?
Thanks in advance
If you want to control the name of the SOAP operation, you can use
[OperationContract(Name = "AOtherMethodName")]
If you really want to control the format of the message on the wire, you'll need to define a message contract
精彩评论