If I have a service contract containing 2 operations, is it possible to have a client side service contract (.NET interface) that only has one of those operations? More generally, is it possible to only use a subset of service operations on the client and even to not have to have generated code for other operations (and their corresponding data contracts)?
The proper way to do this is to create a new OperationContract
that contains only the method you wish to expose and then bind that OperationContract
to a new endpoint and expose that endpoint to your client.
Yes, it's definitely possible. Since you mention generated code, I'm guessing that you're using service references in Visual Studio. If so, you can simply edit the generated interfaces and classes to omit the operations you wish to exclude. However, you will need to perform this edit each time you update the service reference in your client project, so it's probably not an approach you would want to adopt unless the service interface is not expected to change.
Regardless of how often the service might change, a somewhat more elegant approach would involve creating your own adapter with which all your service client code can interact.