IProvEngine::SubmitRequest


Submits a synchronous request to a provisioning engine of Microsoft. Provisioning Framework (MPF) to execute a single procedure in the specified namespace

SubmitRequest is the standard method to invoke provisioning engines for simple requests for both COM and HTTP/SOAP applications.

Syntax

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

Parameters

bstrRequest
XML data node for the request. Accepts all values except \request\procedure.
bstrNamespace
Name of the namespace for the procedure invoked by the request.
bstrProcedure
Name of the procedure invoked by 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: Standard Requests

Average Request Latency Average time for this client to execute a provisioning request. Each call to SubmitRequest contributes to the average latency of up to the last 100 requests.
Request Rate Incoming request rate for this client. Each call to SubmitRequest contributes to the average request rate of transactions per second.
Requests Executing Number of concurrently executing requests at this client. Identifies the total number of concurrent calls to SubmitRequest.
Total Requests Number of requests this client has processed. Each call to SubmitRequest increments this counter.
Total Requests Failed Total number of failed requests that this client initiated. Each call to 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"</request>";

IProvEngine * pProvEngine = NULL;
BSTR bstrRequest = ::SysAllocString(wszRequest);
BSTR bstrNamespace = ::SysAllocString(L"Test Namespace");
BSTR bstrProcedure = ::SysAllocString(L"Write Request");
BSTR bstrRetValue = NULL;
HRESULT hr = E_OUTOFMEMORY;

if(bstrRequest && bstrNamespace && bstrProcedure)
{
	// Create engine client:
	hr = CoCreateInstance(CLSID_ProvEngineClient, NULL, CLSCTX_ALL, IID_IProvEngine, (void**)(&pProvEngine));
	if(hr == S_OK)
	{
		hr = pProvEngine->SubmitRequest(bstrRequest, bstrNamespace, bstrProcedure, &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"Request results", MB_OK);

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

Visual Basic Example

Dim objProvEngine
Dim strRequest
Dim strNamespace
Dim strProcedure
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 & "</request>"

' Namespace:
strNamespace = "Test Namespace"

' Procedure:
strProcedure = "Write Request"

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

See Also

Authorization During Request Submittal, IProvEngine, SubmitRequest, XML Schema for Requests


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