I have developed a WCF application which is being consumed by three .NET web service clients. So far so good.
But now I should change the WCF application in such a way that a different schema is published to different clients.
For example:
class A : IMyServices
{
public string GetName() {}
public Order GetOrderInfo(string orderId) {}
public Payment GetPaymentDetails(Order order) {}
}
One of my clients should not see GetPaymentDetails (I should basically hide this GetPaymentDetails and Payment class schema from the WSDL that is being created by that one client). Other clients will have restrictions on other methods.
In some scenarios some of the Payment class’s properties should not be exposed to a client even it has access to the GetPaymentDetails operation.
Is there any way to expose different schemas for different clients and that requires minimum changes at my end?
One thing to keep in mind: my service is developed using WCF, and clients consuming my services use traditional .NET web service.
How about splitting the interfaces and exposing different endpoints (possibly with different security) for the various contracts? You could design your contracts and implementation along these lines:
Then you can expose endpoints as you like, e.g. something like this:
You could go along similar lines for the Payment DataContracts. The contracts are responsible for making sure the different endpoints get access to different operations and data, whereas under the hood they would share implementations, minimizing the amount of work you need to do to get this to work.