Transport Command

The Transport command is used by client applications to perform one of these functions: add a document, checkin a document, or save content. Use the ITransportCmd interface to specify parameters for the command. Note that all but the simplest Application Integration commands return response XML from which you will generally want to extract the result parameters.

After the Transport command has been executed by calling IAppIntCmd::Invoke, a Transport response component is returned. Client applications may interact with the response component via the standard IAppIntRsp and custom ITransportRsp interfaces. For more information about working with command and response components and their COM interfaces, see Command and Response components.

Reference

DLL FnAppIntTransportCmd.dll
See Also IServletParameter Interface

Interfaces

The Transport command uses the following interfaces:

Interface Description
ITransportCmd This is a custom interface used to initialize the data contained in the Transport command component. The client application can use this interface to specify the transport function to invoke.
ITransportRsp This is a custom interface for the Transport response component that is returned when the Transport command is executed. This interface enables the client application to obtain the result parameters returned from the transport invocation, including retrieving a specific parameter.
IAppIntCmd This is a standard interface which is automatically used by the Transport command to invoke the Transport command component. The client application executes the Transport command by calling this interface and passing the AppIntSession component on which the Transport command component is invoked. Each time the command is executed, a Transport response component is returned.
IAppIntRsp This is a standard interface that is automatically used by the Transport command to determine the success or failure of the command, as well as retrieve any error code or messages.

Example

In the application's StdAfx.h header file:

#import"C:\Program Files\FileNet\AppInt\FnAppIntCmd.tlb"                      named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntHttpRequest.dll"              named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntBrowserDlg.dll"               named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntHttpConnection.dll"           named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntResources.dll"                named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntClientRecordBase.tlb"         named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntClientStore.dll"              named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntSession.dll"                  named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntSessionLogin.dll"             named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntCmdComponents.dll"            named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntTransportCmd.dll"             named_guids no_namespace
------------
typedef std::vector< _bstr_t > ResultTagList;
...
// Instantiate the StdSessionLogin component
IStdSessionLoginPtr spIStdSessionLogin;
HRESULT hResult = spIStdSessionLogin.CreateInstance(__uuidof(StdSessionLogin));
if (FAILED(hResult)) { std::cout << "Could not create the StdSessionLogin component." << std::endl; _ASSERTE(0); } try {
// Initialize the StdSessionLogin component to create // a separate, non-unified login for the client application // by specifying the session / client application name. std::cout << "Initializing the StdSessionLogin component to use NON-unified login..." << std::endl; _bstr_t sessionName(_T("WordPerfect")); spIStdSessionLogin->InitializeViaSessionName(sessionName);
// Instantiate the AppIntSession component
IAppIntSessionPtr spIAppIntSession;
hResult = spIAppIntSession.CreateInstance(__uuidof(AppIntSession)); if (FAILED(hResult)) { std::cout << "Could not create the AppIntSession component." << std::endl; _ASSERTE(0); } // Initialize the AppIntSession component with the StdSessionLogin component
std::cout << "Initializing the AppIntSession component..." << std::endl;
spIAppIntSession->Initialize(spIStdSessionLogin); // * The Client Application may invoke a SessionLogin here; otherwise, // * it will automatically be invoked as needed when commands are executed. std::cout << "Checking Login Status..." << std::endl; VARIANT_BOOL bIsLoggedIn = spIAppIntSession->IsLoggedIn(); if (bIsLoggedIn == VARIANT_TRUE) { std::cout << "User is currently Logged In." << std::endl; } else {
std::cout << "User is NOT currently Logged In." << std::endl;
std::cout << "Attempting Login..." << std::endl;
hResult = spIAppIntSession->Login(); if (FAILED(hResult)) { std::cout << "Login failed." << std::endl; _ASSERTE(0); }
std::cout << "Login succeeded." << std::endl; } // 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); // Execute the Transport command and capture the response component std::cout << "Executing the Transport command..." << std::endl; IAppIntCmdPtr spIAppIntCmd(spITransportCmd);
IAppIntRspPtr spIAppIntRsp = spIAppIntCmd->Invoke(spIAppIntSession);
// Determine if the command failed, before accessing response component data hResult = spIAppIntRsp->GetHResult(); if (FAILED(hResult)) { std::cout << "The Transport command failed to execute." << std::endl; // Examine the error information provided in the standard response component _bstr_t bstrErrorName = spIAppIntRsp->GetErrorName(); std::cout << "ErrorName=" << ( bstrErrorName.length() ? (LPCSTR) bstrErrorName : _T( "" ) ) << std::endl; _bstr_t bstrErrorMsg = spIAppIntRsp->GetErrorMsg(); std::cout << "ErrorMsg=" << ( bstrErrorMsg.length() ? (LPCSTR) bstrErrorMsg : _T( "" ) ) << std::endl; _bstr_t bstrErrorDetails = spIAppIntRsp->GetErrorDetails(); std::cout << "ErrorDetails=" << ( bstrErrorDetails.length() ? (LPCSTR) bstrErrorDetails : _T( "" ) ) << std::endl; _ASSERTE(0); } else { std::cout << "The Transport command succeeded." << std::endl; // Obtain the response name and description from the standard response component _bstr_t bstrResponseDescription = spIAppIntRsp->GetDescription(); std::cout << "ResponseDescription=" << ( bstrResponseDescription.length() ? (LPCSTR) bstrResponseDescription : _T( "" ) ) << std::endl; _bstr_t bstrResponseName = spIAppIntRsp->GetName(); std::cout << "ResponseName=" << ( bstrResponseName.length() ? (LPCSTR) bstrResponseName : _T( "" ) ) << std::endl; // Obtain the specific response information contained in the custom TransportRsp component ITransportRspPtr spITransportRsp(spIAppIntRsp);
_ASSERTE(spITransportRsp != 0); ResultTagList tagList;
tagList.push_back(_bstr_t(_T("/response/objectset/document/properties/property[symname = \"DocumentTitle\"]/value")));
tagList.push_back(_bstr_t(_T("/response/objectset/document/properties/property[symname = \"Name\"]/value")));
for (unsigned int i = 0; i < tagList.size(); i++) {
_bstr_t tagPathName = tagList[i];
_bstr_t bstrResultValue = spITransportRsp->GetResult(tagPathName);
std::cout << "tag=" << (tagPathName.length() ? (LPCSTR) tagPathName : _T("")) << std::endl;
std::cout << "value=" << (bstrResultValue.length() ? (LPCSTR) bstrResultValue : _T("")) << std::endl;
}
_bstr_t bstrResultXml = spITransportRsp->GetResultXml();
std::cout << "resultText=" << (bstrResultText.length() ? (LPCSTR) bstrResultText : _T("")) << std::endl; }
} catch(...) { }