Create Workflow WCF Service.
- Open Visual Studio 2010.
- Setup the Workflow WCF Service project using 'WCF Workflow Service Application' template.
- Rename ‘Service1.xamlx’ to ‘WorkflowService.xamlx’.
- Update 'ReceiveRequest' Activity properties.
- Open the Property Window for ‘ReceiveRequest’ activity.
- Change ‘OperationName field value to ‘PingService’.
- Change ‘ServiceContractName’ to ‘WorkflowService.IWorkflowService’.
- Update Workflow Variables in 'Variables' pane.
- Click on 'Variables' tab just below the Workflow Designer Area to open it.
- Change the 'Variable Type' column of 'data' variable to 'String' type.
- Add new activity to implement some logic for Workflow Service.
- Open ToolBox Window.
- Open 'Primitives' Category.
- Drag ‘InvokeMethod’ activity between 'ReceiveRequest' and 'SendResponse' Activities on Workflow Designer.
- Write some code which will be invoked by workflow.
- Add new class to project with name ‘WorkflowServicePingImp’.
- Add a static method to the ‘WorkflowServicePingImp’ class with the name ‘PingResponse’. This method will take a string argument and return a string value as response.
- Compile the solutions.
- Update 'InvokeMethod' Activity properties to invoke our implementation from 'WorkflowServicePingImp' class.
- Open the Property Window for ‘InvokeMethod’ activity.
- Change the 'TargetType' field value to ‘WorkflowServicePingImp’.
- Change the 'MethodName' field value to ‘PingResponse’.
- Change the 'Parameters' collection by adding new parameter with 'Value' field as 'data' , 'Direction' as 'In' and 'Type' as 'String'.
- Change the 'Result' field value to 'data'.
Run and Test the Workflow Service Directly from Visual Studio 2010.
- Right click on 'WorkflowService.xamlx' file and click on 'Set As Start Page' to set it as start up page for the project.
- Press F5 to run the solution. ( Visual Studio will run the workflow service in development server in some arbitrary port.)
- WCF test client will comp up.
- Double Click on 'PingService' node on left hand side tree view.
- Put some string in the 'Value' column in 'Request' panel.
- Click on 'invoke' button.
- Output will be shown in 'Response' panel.
If the above information is useful, Please provide your valuable feedback.
Thanks.
No comments:
Post a Comment