Building a Service by Using a Specific Workflow

You can use a specific workflow to define a stateless operation. The workflow can implement a request/response operation or a one-way operation. If you implement a one-way operation, the workflow does not send a response, and the operation executes asynchronously from the client application that sent the request.

To implement a specific workflow project

  1. In your DCS solution, right-click the BLSpecific folder, point to Add, and then click BL Specific.
  2. In the Add New Project dialog box, in the Templates pane, make sure that BLSpecific is selected.
  3. Specify a name and location for the project, and then click OK.
  4. In the Create New BL Specific Project dialog box, specify a namespace and service name for the project, and then click Finish.

After you create the workflow project, you can implement the operations that client applications can invoke.

To implement a service operation in a specific workflow

  1. In Solution Explorer, right-click the BLSpecific project, and then click Add New OperationRequest/Response, Add New Operation OneWay, or Add New Operation State Workflow depending on the messaging pattern that your operation will implement and the model of workflow that you want to use.
  2. In the Add New Operation Request/Response, Add New Operation OneWay, or Add New Operation State Workflow dialog box, on the Project Configuration page, provide a name for the operation, and then click Next.
  3. On the Messages Selector page, select the Select messages from assemblies check box if you have manually defined the messages for your operation, and then specify the assembly and class for each message.
  4. Alternatively, clear the Select messages from assemblies check box if you want the DCS Software Factory to generate the message classes automatically.
  5. On the Messages AssembliesReferences page, verify that the correct assembly references are being added to the project, and then click Finish.
Dd632304.note(en-us,MSDN.10).gifNote:
If you are generating messages automatically, the list of references on this page is empty. When you add message classes, each message assembly is inspected and any namespaces that the message assembly references are added to the service implementation.

After you have created an operation, you implement the operation functionality.

To implement business logic for an operation

  1. In Solution Explorer, under the operation node, double-click the operationNameWorkflow.cs file to open the operation workflow for editing.
  2. Implement your operation functionality in the same way that you would for any Windows Workflow Foundation (WF) application. You can use any of the ordinary WF activities in addition to the custom DCS activities.
  3. Dd632304.note(en-us,MSDN.10).gifNote:
    The operation workflow includes three automatically generated properties called Request, Response, and Context. The Request and Response properties are instances of the Request and Response message classes that you selected for the operation. The Context property contains the current context passed in by the client application that makes the request. You can use these properties in your workflow business logic to retrieve messages that are passed into the workflow and to set properties that the workflow returns to the invoking application.

  4. If you implement a request-response operation in a conversational workflow, you can choose to add a SendResponse activity as the final activity in the workflow. You configure the activity to send an instance of the response message that you specified for the operation. You can use the automatically generated Response property in the workflow class to specify the message to return to the client application.

After you implement the functionality that you require, save your code and then build the project for deployment.

Show: