Procedure Examples


Microsoft® Provisioning Framework (MPF) uses procedures in multiple XML documents. The following examples show a namespace with a procedure definition and a request that uses the procedure.

Namespace Procedure

<namespace name="New Namespace" version="1" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <procedure name="New Request" type="write" access="public">
	<execute namespace="Test Namespace" procedure="Write Request">
	<forEach name="organization" root="data" 
		path="organizations/organization"/>
	<before source="organization" destination="executeData">
		<xsl:template match="organization[@type='primary']">
		<primaryOrg>
			<xsl:value-of select="@name"/>
		 </primaryOrg>
		</xsl:template>
		<xsl:template match="organization[@type='secondary']">
		 <secondaryOrg>
			<xsl:value-of select="@name"/>
		</secondaryOrg>
		</xsl:template>
	</before>
	<after source="executeData" destination="data" 
		destinationPath="orgSignup" mode="merge"/>
	</execute>
  </procedure>
</namespace>

The namespace registration XML for New Namespace contains the procedure New Request.

The execute node calls Write Request, a procedure belonging to the namespace for the Test Namespace provider.

The forEach, before, and after nodes define the XSL transformation. The forEach node restricts the range of the search to the request's /data/organizations/organization nodes. The xsl nodes in before select the values for the name attribute from the source (namely, organization nodes of type "primary" and "secondary") and pass them to the destination (the Write RequestexecuteData node). Because this operation supplies data to Write Request, it occurs before Write Request is executed. The after node retrieves the name values from the Write Request executeData node and merges them into the /data/orgSignup of the response.

Request Procedure

In the following sample request, the data node supplies the source data.

<request xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <data>
	<organizations>
	<organization name="OrgA" type="primary"/>
	<organization name="OrgB" type="secondary"/>
	<organization name="OrgC" type="secondary"/>
	</organizations>
  </data>
  <procedure>
	<!-- Procedure call to SignupOrg-->
	<execute namespace="New Namespace" procedure="New Request">
	<before source="data" destination="executeData" mode="merge"/>
	<after source="executeData" destination="data" mode="merge"/>
	</execute>
  </procedure>
</request>

The procedure starts with a call (not shown) to SignupOrg. New Request receives the response (in this case, the organization names) returned by the execution step (SignupOrg). The before node merges the data from the data node into the executeData node for SignupOrg. The after node merges information from New Request's executeData node into the response data. (In this simple example, the returned data is the same as what was originally passed by before.)

See Also

XML Schema for Procedures


Up Top of Page
© 1999-2002 Microsoft Corporation. All rights reserved.