Nick Nick - 16 days ago 7
C# Question

Does adding a method to a WCF ServiceContract break existing clients?

We have an existing ServiceContract

[ServiceContract(Namespace = "http://somesite.com/ConversationService")]
public interface IConversationService
{
[OperationContract(IsOneWay = true)]
void ProcessMessage(Message message);

[OperationContract(IsOneWay = true)]
void ProcessMessageResult(MessageResult result);
}


and we need to add a method to it

[ServiceContract(Namespace = "http://somesite.com/ConversationService")]
public interface IConversationService
{
[OperationContract(IsOneWay = true)]
void ProcessMessage(Message message);

[OperationContract(IsOneWay = true)]
void ProcessMessageResult(MessageResult result);

[OperationContract(IsOneWay = true)]
void ProcessBlastMessage(BlastMessage blastMessage);
}


Will this break any existing wcf clients that are using this service? Or will we have to update all existing wcf clients?

EDIT: This service is using both netTcpBinding and netMsmqBinding

Answer

I think your existing clients will continue to work. After all this is very similar to SOAP and web services in that the client will connect to the given URL and request a specific service. If you take methods away you will risk breakage (only if the method is used I believe) but adding should be pain free.

I've only dabbled in WCF but have used the ASP.NET web services in this way to great success.

Comments