IProvEngine::SubmitTrustedRequest


Submits a synchronous request to a provisioning engine of Microsoft. Provisioning Framework (MPF) to execute one or more procedures using the request XML from a trusted user credential. 

By default, only members of the groups Administrators, MPFAdmins, and MPFTrustedUsers are allowed to call this method.

Syntax

C++
HRESULT SubmitTrustedRequest (
	BSTR bstrRequest,
	BSTR * bstrResponse
);
Visual Basic
Function SubmitTrustedRequest ( _
	bstrRequest As String _
) As String

Parameters

bstrRequest
XML data, procedure, and context nodes for the request. 
bstrResponse  (C++) / return value (VB)
XML response node returned for the request.  

Return Codes

Zero indicates success; a non-zero value represents an error. For a list of error codes, see MPF Errors.

Performance Counters

Counter Object: Microsoft. Provisioning Client
Counter Instance: Trusted Requests

Average Request Latency Average time for this client to execute a provisioning request. Each call to IProvEngine::SubmitRequest contributes to the average latency of up to the last 100 requests.
Request Rate Incoming request rate for this client. Each call to IProvEngine::SubmitRequest contributes to the average request rate of transactions per second.
Requests Executing Number of concurrently executing requests at this client. This counter identifies the total number of concurrent calls to IProvEngine::SubmitRequest.
Total Requests Number of requests this client has processed. Each call to IProvEngine::SubmitRequest increments this counter.
Total Requests Failed Total number of failed requests that this client initiated. Each call to IProvEngine::SubmitRequest that returns a failed HRESULT increments this counter.

C++ Example

LPCWSTR wszRequest = L"<request>\n" + 
					 L"  <data>\n" +
					 L"	<organizations>\n" +
					 L"	<organization name=\"tailspintoys.com\"/>\n" +
					 L"	</organizations>\n" +
					 L"  </data>\n" +
					 L"  <context>\n" +
					 L"	<clientContext clientTransactionId=\"53367B03-63D3-44ae-B8AD-C1E57E876E6C\"/>\n" +
					 L"  </context>\n" +
					 L"  <procedure>\n" +
					 L"	<execute namespace=\"Test Namespace\" procedure=\"Write Request\">\n" +
					 L"	<forEach name=\"organization\" root=\"data\"\n"  +
					 L"			 path=\"organizations/organization\"/>\n" +
					 L"	<before source=\"organization\" destination=\"executeData\"/>\n" +
					 L"	</execute>" +
					 L"  </procedure>" +
					 L"</request>";

IProvEngine * pProvEngine = NULL;
BSTR bstrRequest = ::SysAllocString(wszRequest);
BSTR bstrRetValue = NULL;
HRESULT hr = E_OUTOFMEMORY;

if(bstrRequest)
{
	// Create engine client:
	hr = CoCreateInstance(CLSID_ProvEngineClient, NULL, CLSCTX_ALL, IID_IProvEngine, (void**)(&pProvEngine));
	if(hr == S_OK)
	{
		hr = pProvEngine->SubmitTrustedRequest(bstrRequest, &bstrRetValue);
		pProvEngine->Release();
}
}

// Get the error description in the case of error
if(FAILED(hr))
{
	IErrorInfo* pErrInfo = NULL;
	if(::GetErrorInfo(0, &pErrInfo) == S_OK && pErrInfo)
	{
		pErrInfo->GetDescription(&bstrRetValue);
		pErrInfo->Release();
}
}

// Show the results
MessageBoxW(NULL, bstrRetValue ? bstrRetValue : L"Unknown error occured", L"Trusted request results", MB_OK);

// Clean up
::SysFreeString(bstrRequest);
::SysFreeString(bstrRetValue);

Visual Basic Example

Dim objProvEngine
Dim strRequest
Dim strRetValue

On Error Resume Next

' Request:
strRequest = ""
strRequest = strRequest & "<request>"
strRequest = strRequest & "  <data>"
strRequest = strRequest & "	<organizations>"
strRequest = strRequest & "	<organization name=""tailspintoys.com""/>"
strRequest = strRequest & "	</organizations>"
strRequest = strRequest & "  </data>"
strRequest = strRequest & "  <context>"
strRequest = strRequest & "	<clientContext clientTransactionId=""53367B03-63D3-44ae-B8AD-C1E57E876E6C""/>"
strRequest = strRequest & "  </context>"
strRequest = strRequest & "  <procedure>"
strRequest = strRequest & "	<execute namespace=""Test Namespace"" procedure=""Write Request"">"
strRequest = strRequest & "	<forEach name=""organization"" root=""data"" path=""organizations/organization""/>"
strRequest = strRequest & "	<before source=""organization"" destination=""executeData""/>"
strRequest = strRequest & "	</execute>"
strRequest = strRequest & "  </procedure>"
strRequest = strRequest & "</request>"

' Create engine client:
Set objProvEngine = CreateObject("Provisioning.ProvEngineClient.1")
If Err.Number = 0 Then
	strRetValue = objProvEngine.SubmitTrustedRequest(strRequest)
	If Err.Number = 0 Then
		MsgBox strRetValue
	Else
		MsgBox Err.Description
	End If
End If

See Also

Authorization During Request Submittal, IProvEngine, Security Contexts, SubmitTrustedRequest, XML Schema for Requests


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