Creating DSS Service Projects
Glossary Item Box
Service projects can be created in multiple ways depending on whether you prefer a solution integrated into Visual Studio (VS), a command line interface, or using Microsoft Visual Programming Language (VPL) to generate code.
|All RDS samples are distributed in Visual Studio 2010 format. By default new projects are also created in VS2010 format. You cannot open these projects using previous versions of Visual Studio.|
Visual Studio New Project Wizard
From within Visual Studio, DSS service projects can be created by selecting New Project on the File menu, then select Visual C# and Microsoft Robotics. Then select the DSS Service Template. Depending on the number of templates you have installed in Visual Studio this may look similar to the following:
Note that you can install the different versions of RDS side-by-side. See the section Migrating Services if you need to move services between versions of RDS.
If you have multiple versions of RDS installed there might be multiple templates. For example, the RDS 2008 R2 release shows up as "DSS Service (2.1)" and RDS 2008 R3 is listed as "DSS Service (2.2)". RDS 4 is version 4.0.
When you create a new service using the Wizard, it is advisable to create it under your RDS installation. You can create a new folder under the RDS installation for your own use, e.g. Projects. You should not create your own services under the Samples folder because these services are supplied as part of RDS.
Once you click on OK, you will be presented with the Service tab of the New DSS Service wizard:
In most cases you can accept the default values for the service name, namespace, organization, year and month. These details are used to construct the Contract Identifier that uniquely identifies your service from all other services. If you are working for an organization that might want to distribute the service, then change the Organization domain to your own domain name. (The domain schemas.tempuri.org is just a temporary domain name. It is not a real domain. It is not necessary to use a real domain because this URI is only used to make a Contract ID unique. You do not use it in a web browser like a normal URL. Note that DssProxy will issue a warning message when you compile if you do not change this placeholder domain to something else.)
If you want your service to be able to accept Subscribe requests (and send notifications) then you should tick the Use subscription manager checkbox. The Add documentation comments checkbox turns on generation of XML comments when you compile.
Click on the Partners tab to set up partnerships between your service and other services.
You can select a partner service from the list. (This list should show all services that are installed on your computer. This includes other services that you might have written yourself.)
Give each partner a name (to refer to it in the code), select a creation policy from the drop-down list, and decide if you want to receive notifications from the partner, i.e. you plan to subscribe to the partner service.
Once you have added all of the partners you require, click on the Alternate Contracts tab.
An alternate contract is normally a generic contract which describes the set of operations (requests and responses) that this service will support in a generic way. For example, the generic analog sensor provides a numeric value that it reads from the sensor. By using generic contracts you can make your service accessible to other services in a standardized way so that they do not need to know the specific operations supported by your base service.
Note that if you are just implementing a generic contract, then you will do so on your main operations port. In this case you can tick the checkbox under the name.
When you have finished adding alternate contracts, click on OK and your new service will be created.
DSS New Service Generation Tool
The DSS New Service Generation Tool (DssNewService.exe), is a command line tool which can be executed from a Decentralized Software Services (DSS) command prompt. This tool can create a service project C# using a variety of options determining the properties of the project.
Creating a service using DssNewService is not described here. Note however that it does not provide all of the options that are available using the VS Wizard and the Wizard is easier to use especially if you are a new user.
Visual Programming Language
To get started writing services in VPL, please see the VPL Tutorials Overview.
DSS User Guide: DSS Service Projects Overview
© 2012 Microsoft Corporation. All Rights Reserved.