Share via


Walkthrough: Implementing a DCS Stub

This walkthrough creates a DCS Stub operation in a Stub project, which lets you create a service contract without requiring you to implement the actual operation functionality. You can use the Stub project to create a proxy that client application developers can develop against, while you then implement a WFTask project, to provide the actual service functionality. For more information, see Walkthrough: Implementing a DCS Task

The walkthrough creates a Stub project named WeatherInformationStubs in a DCS Solution project named WeatherInformation.

Before you begin

  1. Create a DCS solution named WeatherInformation in the E:\Walkthroughs folder. For detailed instructions about how to create a DCS Solution project, see Walkthrough: Creating a DCS Solution.
  2. Create the WeatherInformationMessages messages project in the DCS Solution project. For detailed instructions about how to create this messages project, see Walkthrough: Creating a DCS Messages Project.

Detailed Instructions

To create a DCS Stub project

  1. In Solution Explorer, right-click the Stub folder, point to Add, and then click Stub.

  2. In the Add New Project dialog box, in the Templates list, click Stub.

  3. In the Name box, type WeatherInformationStubs, and then click Browse.

  4. In the Project Location dialog box, browse to E:\Walkthroughs\WeatherInformation\Stub, and then click OK.

  5. In the Add New Project dialog box, click OK.

  6. The following image shows the Add New Project dialog box.

  7. Dd631973.d787d248-0c9b-4505-bc5d-7ad74da2c516(en-us,MSDN.10).png

  8. The Add New Project dialog box configured to create a new Stub project named WeatherInformationStubs in the E:\Walkthroughs\WeatherInformation\Stubs folder

  9. In the Create New Stub Project dialog box, in the Namespace box, type WeatherInformationNamespace.

  10. In the Service Name box, type WeatherInformationService, and then click Finish.

  11. The following image shows the Create New Stub Project dialog.

  12. Dd631973.e438cb05-5d8e-42f3-9a07-eb0449cb46d4(en-us,MSDN.10).png

  13. The Create New Stub Project configured to create the new project in the WeatherInformationNamespace namespace, and create a new service instance named WeatherInformationService

  14. Visual Studio generates the new project.

To create a stub operation definition in the Stub project

  1. In Solution Explorer, right-click WeatherInformationStubs, and then click Add New OperationRequest/Response.

  2. In the Add New Operation Request/Response dialog box on the Operation Configuration page, in the Operation Name box, type GetTemperature, and then click Next.

  3. The following image shows the Operation Configuration page.

  4. Dd631973.d4dfc839-b077-4a10-ab26-80896133c6f2(en-us,MSDN.10).png

  5. The Operation Configuration page of the Add New Operation Request/Response dialog box, configured to create a new operation named GetTemperature

  6. On the Messages Selector page, click the ellipsis button (…) adjacent to the Select type of Request message box.

  7. In the Please choose a file dialog box, browse to the E:\Walkthroughs\WeatherInformation\Messages\WeatherInformationMessages\bin\Debug folder, click WeatherInformationMessages.dll, and then click Open.

  8. In the Add New Operation Request/Response dialog box on the Messages Selector page, configure the operation messages as follows, and then click Next:

    • Select type of Request message: GetWeatherRequest
    • Select type of Response message: GetWeatherResponse
    • Select type of Error: WeatherInformationError
    • Select type of Exception: WeatherInformationException
  9. The following image shows the Messages Selector page.

  10. Dd631973.ee9896b1-d377-49ae-b343-7f58d3305091(en-us,MSDN.10).png

  11. The Messages Selector page of the Add New Operation Request/Response dialog box, configured to set the Request message of the new operation to GetWeatherRequest, and the Response message to GetWeatherRessponse

  12. On the MessagesAssembliesReferences page, in the AssembliesReferences list, verify that the WeatherInformationMessages(Project) item is selected, and then click Finish.

  13. The following image shows the Messages Assemblies References page.

  14. Dd631973.555be246-89a8-4494-8c3b-c39ac02fda80(en-us,MSDN.10).png

  15. The Messages Assemblies References page of the Add New Operation Request/Response dialog box. Verify that, where possible, Visual Studio selects project links for any associated assemblies. These references will automatically update when a change occurs in the associated project

Continue adding stub operations to your project until you have completed the service contract. After you finish, you can generate a proxy for the Stub project and distribute it to the developers who are implementing the tasks that implement the operations defined by the stub and to developers who are building client applications.

To generate a proxy for a Stub project

  1. On the Build menu click BuildWeatherInformationStubs.
  2. In Solution Explorer, right-click the WeatherInformationStubs project in the Stubs folder, and then click Deploy Assembly. For more information, see Walkthrough: Deploying DCS Services by Using Visual Studio.

After you implement a stub for the service, you can implement the operation functionality in a WFTask project. For more information, see Walkthrough: Implementing a DCS Task.

See Also

Walkthrough: Creating a DCS Solution

Walkthrough: Creating a DCS Messages Project

Walkthrough: Implementing a DCS Task

Deploying DCS Services

Building Client Applications