Reputation: 21376
I'm new to WF4. What I want to do is to expose WF4 state machine as a WCF service.I have created the state machine. How can I execute the transition triggers and change the status using WCF. http://channel9.msdn.com/Shows/Workflow-TV/endpointtv-WF4-State-Machine-Hands-On-Lab-Exercise-2 . This is the tutorial I have used to create the state machine.
Upvotes: 0
Views: 2639
Reputation: 2320
If u don't want send and receive activity's it's possible with some work. The send and receive activity's can be hard to write for end customers doing correlation stuff. The other side is that it would be alot better if there was a generic entrance for the client so the client doesn't need to have a updated service reference, but only a contract definition.
We removed all correlation and created a generic webservice that re-route to a specific xamlx workflow, but not using send/receive activities. Instead we use bookmarks inside a xamlx workflow. So we created a own activity to receive custom pageflow data and another activity to send data back to the instance. The only problem we had.
public interface IWorkflowService
{
#region State Machine / Pageflow Operations
[OperationContract]
IPageflowData Start(IPageflowData pageflowData);
[OperationContract(Name = "StartWithInputs")]
IPageflowData Start(IPageflowData pageflowData, IDictionary<string, object> inputs);
[OperationContract]
IPageflowData Resume(PageflowCommand command, IPageflowData pageflowData);
[OperationContract(Name = "ResumeWithExecuteCommand")]
IPageflowData Resume(string commandName, IPageflowData pageflowData);
[OperationContract]
IPageflowData ResumeTo(string stepName, IPageflowData pageflowData);
#endregion
This is combined with dynamic endpoints as available in the WF samples called WorkflowCreationEndpoint implementing the IworkflowCreation contract.
[ServiceContract(Name = "IWorkflowCreation")]
public interface IWorkflowCreation
{
[OperationContract(Name = "Create")]
Guid Create(IDictionary<string, object> inputs);
[OperationContract(Name = "CreateWithInstanceId", IsOneWay = true)]
void CreateWithInstanceId(Guid instanceId, IDictionary<string, object> inputs);
[OperationContract(Name = "ResumeBookmark")]
void ResumeBookmark(Guid instanceId, string bookmarkName, object bookmarkValue);
}
Upvotes: 0
Reputation: 3279
I wrote a sample that shows how to do this at State Machine Security Door. Basically you just use Send/ReceiveReply pairs in the transitions.
Upvotes: 2