WCF Workflow Interface REST Interface

Possible duplicate:
RESTful Workflow Service Endpoints in WF4 / WCF

I am trying to get Windows Workflow Services 4.0 to work with the REST interface. I have a very simple workflow service called "Service1" with receiveRequest and sendResponse activity.

By default, WF Services automatically generates classes and interfaces, however I would like to force the WF service to use my own REST interface, and not some kind of internal auto-generated interface.

The interface will be as follows:

[ServiceContract] public interface IService { [OperationContract] [WebInvoke( UriTemplate = "/Data/{item}", Method = "GET" )] String GetData( Int32 item ); } 

However, I am having difficulty configuring XAML to work with this interface. I would need such a XAML configuration to indicate that the service contract name is my own contract:

  <Receive x:Name="__ReferenceID0" CanCreateInstance="True" DisplayName="ReceiveRequest" sap:VirtualizedContainerService.HintSize="464,90" OperationName="GetData" ServiceContractName="w:IService"> 

However, when I start this workflow service, I get the following exception:

The name of the contract "wfService.IService" cannot be found in the list of contracts implemented by the service "Service1".

However, the service created behind the scenes does not implement the IService interface, and I would like to know how I can extend the service that is created by the workflow engine instance to implement my own interface (which I described above)?

thanks

+1
c # workflow rest wcf workflowservice
source share
1 answer

In WF4, you cannot declare a ServiceContract in code and use it. The contract is declared in XAML, and WorkflowServiceHost generates the endpoint from the advertisement.

To enable REST for your workflow, you have several options:

  • Use the HttpWorkflowHost from http://wf.codeplex.com/wikipage?title=WebAPIWorkflow . The limitation is that then you will only have REST.
  • Do something similar: http://msdn.microsoft.com/en-us/library/aa967564.aspx The differences are as follows: replace WorkflowFormatterBehavior instead of DataContractSerializerOperationBehavior, the arguments are extracted from the contract agreement instead of the work contract and keep in mind that you will not have the client side of this example, and you will have to format the response according to the protocol.
+3
source share

All Articles