The WES Toolkit provides the WES project template for Visual Studio.
You can create a new WES by using this template. You modify the sample code
that it generates and implement the functionality that is required by your
service.
To create a new WES Project, use Visual Studio and perform the
following steps:
- In the Visual Studio, on the File menu,
point to New, and then click
Project.
- In the Project types pane of the New
Project dialog, click Visual C#, and then in the
Templates pane, under My
Templates, click Well-enabled Service.
- In the Name box type the name of your
service.
- Click OK.
.jpg)
Elements of a WES Project
The sample WES that is defined by the project consists of a class called
WellEnabledService. The WellEnabledService
class implements the Connected Services Framework
CsfEventingService class, as well as the WES interfaces.
The WES interfaces themselves are combined into a single C# interface
definition called IWes. The files and folders in the WES
project provide the definitions of the various parts of the
IWes interface, and the sample implementation in the
WellEnabledService class. You edit these files to implement
the functionality that is required by your WES. For more information, see
>Implementing the
Provisioning Interfaces, >Implementing the Health
Interfaces, >Implementing the Discovery
Interfaces, and >Implementing the Usage
Interfaces.
The following class diagram shows the sample implementations of the
WellEnabledService class and the IWes
interface:
.jpg)
In addition to these folders that define the WES interface, the WES
project contains a Utilities folder which contains several
classes referred to by the other classes in the WES:
-
Constants.cs. Defines the constants that are used
to specify Action parameters for all the WES methods. The Action
parameter of the OperationAttribute of a method defines a unique URI
for each method.
-
ErrorCodes.cs. Defines the error codes for all the
interfaces except provisioning.
-
IPointCut.cs. Defines the interface for the
PointCut implementation. PointCut is a class that
performs common operations, such as logging, initialization, and
clean-up at the start and end of every method. You should not need to
modify this interface or the PointCut class.
-
IResponseType.cs. Defines the interface that a
provisioning response should conform to. Only the provisioning
responses that require the error message and status
information fields of the response to be populated implement this
interface.
-
PointCutFactory.cs. Provides a class that generates
new PointCut objects.
-
MethodPointCut.cs. Implements the IPointCut
interface and defines methods to perform common operations at
the entry and exit of WES methods.
-
ProvisioningMethodPointCut.cs. Implements the
IPointCut interface and derives from the
MethodPointCut class. Defines methods to perform
common operations at the entry and exit of Provisioning operations.
-
UsageMethodPointCut.cs. Extends the
MethodPointCut class and defines methods to
perform common operations at the entry and exit of usage
operations.
-
WellEnabledServicePerfCounters.cs. Defines a class
to create, initialize, increment, decrement, and remove the performance
counters for the WES. You should not need to modify this class.
The WES project also contains the files that are used to configure the
Web service and specify its security requirements. For more information, see
>Configuring Security.
Resolving References to Connected Services Framework Assemblies
The WES project requires you to modify the references to
Connected Services Framework libraries, which are installed when the WES
Toolkit is installed, otherwise your WES does not build correctly. To
enable Visual Studio to resolve these references, perform the following
steps:
-
in the Solution Explorer, right-click the WES
project, and click Properties.
-
In the Properties page, click the Reference
Paths tab.
-
Next to the Folder text box, click the
ellipsis.
-
In the Select Reference Path page, browse to
the Bin folder in the directory where the WES Toolkit is
installed, and then click Open. By default, the WES
Toolkit is installed in the C:\Program Files\Microsoft CSF\V3.0\WES
Toolkit\ folder.
-
Click Add, to add this path to the reference paths
for the project.
-
On the Visual Studio tool bar, click Save All,
and then close the properties page.
See Also