ITransportCmd::Initialize

The Initialize method is called to initialize the Transport command, by specifying the transport function to perform and passing any necessary input parameters required for the function. The list of parameters is created through the use of the IServletParameter interface, which is used to specify each input parameter name and value.

void spITransportCmd->Initialize(_bstr_t bstrMethodName,
                                 VARIANT vParameterList);
Parameters
bstrMethodName - [in] Required _bstr_t, which specifies the name of the transport function to perform. This function name is expected to be one of the following: "addDocument", "checkinDocument", or "saveContent".
vParameterList - [in] Required pointer to a VARIANT, which specifies a SAFEARRAY of the input parameters required to invoke the transport function. When no input parameters are required, a value of VT_EMPTY should be specified.
Results
This method always returns an HRESULT value of S_OK if successful.
Sample
The following is a fragment from the complete example for the Transport command.
   ...
   // Instantiate the custom Transport command component
   ITransportCmdPtr spITransportCmd;
hResult = spITransportCmd.CreateInstance(__uuidof(TransportCmd));
if (FAILED(hResult)) {
std::cout << "Could not create the Transport command component.\n"; _ASSERTE(0);
} // Initialize the custom Transport command component // with the method name and required input parameters. _bstr_t bstrMethodName(_T("getEntryTemplates"));
const DWORD cNumElements = 2;
long lCount = 0;
COleSafeArray saParameters(VT_DISPATCH, cNumElements); { // Instantiate a ServletParameter component
IServletParameterPtr spIServletParameter(__uuidof(ServletParameter)); _ASSERTE(spIServletParameter != 0); // Initialize the ServletParameter component to hold the input parameter spIServletParameter->Initialize(_T("objectstoreid"), _T("DEV1 FS")); saParameters.PutElement(&lCount, spIServletParameter);
}
{
lCount++; // Instantiate a ServletParameter component
IServletParameterPtr spIServletParameter(__uuidof(ServletParameter));
_ASSERTE(spIServletParameter != 0);
// Initialize the ServletParameter component to hold the input parameter spIServletParameter->Initialize(_T("objecttype"), _T("1"));
saParameters.PutElement(&lCount, spIServletParameter);
}
_variant_t vParameterList(saParameters); std::cout << "Initializing the Transport command component..." << std::endl; spITransportCmd->Initialize(bstrMethodName, vParameterList); ...