Create a Service Module
The Microsoft Provisioning System (MPS) Sample Provisioning UI
Service Modules are implemented as ASP.NET User Controls. In this
section, you will use Microsoft Visual Studio 2005 and the sample
components in the Sample Provisioning User Interface Framework to
create a sample service module.
Procedure MPSSDK.x: To create a
service module using the Sample Provisioning User Interface
Framework
- Add a folder named DemoServiceModule under ServiceModules
folder in the project.
- Navigate to the DemoServiceModule folder in the Project
Solution folder, and then click Add new item.
- Select the ServiceModule item (which is available in C#
language option only) from the list, and then set the name to
DemoServiceModuleAction.ascx.
- In the design view of the user control, add the following
components:
- A label server control for displaying the error message for
error scenarios. This is already available in the template.
- A panel control that will be used as a placeholder for all the
input controls (both required fields and optional fields to be
placed here). This panel will be referred to as the Global
panel. This is already available in the template.
- An empty panel control. This is just a placeholder panel, which
will be used by the framework. All the optional fields will be
automatically moved to this panel at runtime. This panel will be
referred to as the Optional fields panel. This is already
available in the template.
- A Submit button that will be used to post the information
entered in the UI to a Web service. The Submit button (and any
other button such as, for example, Cancel) should be placed below
the Optional fields panel. This is already available in the
template.
If you intend to develop a service module that uses the sample
service module validator, your project must meet the following
prerequisites:
- The Global panel contains only a table control.
- The Table control contains only the following two columns:
- The first column contains labels.
- The second column contains a single control (either required or
mandatory).
- The Optional fields panel contains an empty Table control.
Verify that the user control class in the code used by
DemoServiceModule.ascx.cs inherits from
ServiceModuleBaseUserControl class. This inheritance is set in the
template by default. This sample also includes code that:
- Creates a Request object and sets associated data.
- Makes a call to the required Web method and takes further
actions depending on the returned response.
Examples of how you can use or extend this sample code
include:
- After a successful Web method call, make a call to the
SetStatus() function (available as base class method) and pass the
success message as a parameter. This would be followed by a call to
Finish() function (available as base class method) that would load
the Action List page, showing a status message.
- After a failed Web method call, set the error label control's
text to the error message. This would result in the user staying on
the service module page with error displayed at the appropriate
location.