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);
VT_EMPTY
should be specified. ...
// 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);
...