Reputation: 27360
Is it possible to change a parameter name of an asmx web service without breaking clients? For example, consider a legacy service which has a web method like so:
[WebMethod]
public string HelloWorld(string NAME)
{
return "Hello World and " + NAME;
}
The legacy service web method has the parameter NAME, but I'd like to change this to 'Name' to follow coding guide-lines. Will this break existing clients?
Upvotes: 1
Views: 1117
Reputation: 33173
The simplest might be to add a new method
//New clients use this Maybe you put it in a new asmx file.
[WebMethod]
public string Hello_World(string FullName)
{
return HelloWorld(FullName);
}
//Old clients use this.
[WebMethod]
public string HelloWorld(string NAME)
{
return "Hello World and " + NAME;
}
WCF has ways of having a Method name and parameter be one thing, but the xml be another using annotations. I think there is a way to create a WCF service that can talk to legacy ASMX clients, I haven't tried it. In that scenario you could rename all your methods and parameters and via attribute annotations, maintain the old names for the xml across the wire.
Upvotes: 1