Home
TeamSite
Problem in using WorkSite MP SDK from C++
kshitij
Hi,
I am trying to use the WorkSite MP SDK to implement a program in C++. I am able to create the COM objects. But when I try to call any APIs, I get an error saying "Not implemented". I am using the iManMp.dll with version "4.1.0.0.9". Is there some configuration that needs to be done for this ? Do I need JDK for this purpose ? Any help would be appretiated.
Thanks,
Kshitij Gupta
Electronics For Imaging, Inc.
Find more posts tagged with
Comments
Migrateduser
The Worksite MP SDK requires the Microsoft Java VM.
The SDK should include the iManMP.dll and iManMp.zip. The .zip contains the Java classes and it is necessary to get this into the classpath. You can get the .zip into the classpath for the local machine by adding it to the registry in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Java VM\\. There is a Classpath key that should be updated. You should also be able to set the environment classpath with 'set classpath = %classpath%; "pathtozip\iManMp.zip"', but I haven't tried that in a while; I know the registry setting works.
Here's a sample logon (no guarantee, I didn't compile it!):
int main(int argc, char* argv[])
{
ISessionManagerFactoryPtr pSessionManagerFactory;
char szPath[] = "C:\\temp\\WSMPSDK\\";
char szLogFile[] = "C:\\temp\\WSMPSDK\\logs\\wsmptest.log";
char szCluster[] = "MyServer" ;
char szDomain[] = "MyDomain" ;
char szUserId[] = "MyUserid";
char szPassWord[] = "MyPassword";
try
{
cout << "wsmptest is Running.\n" << endl;
// init COM
CoInitialize(NULL);
// access the SessionManagerFactory
HRESULT hr = pSessionManagerFactory.CreateInstance(__uuidof(WtSessionManagerFactory));
// setup logging and app. name
pSessionManagerFactory->e_setCmsDir(_bstr_t(szPath));
pSessionManagerFactory->e_setOut(_bstr_t(szLogFile));
pSessionManagerFactory->e_setApplicationName(_bstr_t("wsmptest"));
// get a SessionManager
ISessionManagerPtr pMgr = pSessionManagerFactory->e_getSessionManager();
// create a Session to a cluster
ISimpleSessionPtr pSession = pMgr->e_createSimpleSession("wsmptest", _bstr_t(szCluster));
// Logon
IUserPtr pUser = pSession->e_logon2(_bstr_t(szDomain),_bstr_t(szUserId),_bstr_t(szPassWord));
cout << "Logged On successfully..." << endl;
/* do some work here */
// logoff & cleanup
pSession->e_logoff();
cout << "Logged off successfully." << endl;
pMgr->e_destroySession(pSession);
cout << "Destroyed session." << endl;
}
catch(...)
{
// Exception has been caught
IExceptionHandler *pExceptionHandler;
// access the exception handler
pSessionManagerFactory->getExceptionHandler(&pExceptionHandler);
// get the stack trace
_bstr_t strExcp = pExceptionHandler->e_getStackTrace();
// and dump it out
cout << "Stack Trace:" << strExcp << endl;
pExceptionHandler->printStackTrace();
}
return 0;
}
Migrateduser
Here's an attachment with the sample that didn't make it on the first try.
kshitij
Thanks a lot for your help. I was able to use the API for connecting to the server.
- Kshitij
shirinp
I'm actually having problems running it in C++ as well.. I tried the code snippet you posted, but it fails at the beginning, where you have:
HRESULT hr = pSessionManagerFactory.CreateInstance(__uuidof(WtSessionManagerFactory));
hr fails. I made sure to put in the registry key the path to the zip as well under the class path. Am i supposed to put the path.zip or the path to the extracted zip file? Nonetheless, I put both and neither work...
Would you know why?
Thanks!