Workflow operations inherit from custom ServiceContract

Feb 23, 2012 at 6:14 PM

I have a project with two workflow services, both contain the same activities/operations. My purpose is to make all operations on both workflos services inherit from the same ServiceContract (which I wrote in a sepparate file - MyNamespace.IService) so I can decide on the client in runtime which workflow service to call, by using ChannelFactory.

If I set ServiceContractName to {MyNamespace}IService, it compiles, but when I add the service reference to both workflow services, the client reference generates the IService with the reference namespace.

 

The idea on the client is to run as follows:

ChannelFactory<MyNamespace.IService> channelFactory = new ChannelFactory<MyNamespace.IService>("endpointname");

MyNamespace.IService channel = channelFactory.CreateChannel();

channel.RunOperation(someParameter);

 

When I run this the workflows run perfectly but the return values of the service operations are always null.

Is there any configuration/workaround to allow this to work?

Thank you.

 

Feb 24, 2012 at 4:04 PM

Solved.

The only problem was that on the SendReply activity the name of the parameter should follow the syntax <ReceiveOperation>Result.

Example:

Receive activity operation name: ReceiveOperation

SendReply activity parameter name: ReceiveOperationResult

This way it it possible to use a single ServiceContract and make all workflows inherit from it.