Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi all,
I try to use mks api but without success and don't know why (but i'm a rookie )
I use Visual studio express 2012 and the C api for integrity 10.4 API Version: 4.12.4301.
My problem is i always get NULL response, i try with different command but it's always the same.
#include "stdafx.h"
#include "mksapi.h"
mksIntegrationPoint ip = NULL;
mksSession session = NULL;
mksCmdRunner cr = NULL;
mksrtn rtn = MKS_SUCCESS;
mksCommand MyCmd;
mksResponse MyResponse;
mksResult MyResult;
mksItem MyItem;
mksField field = NULL;
mksWorkItem wi = NULL;
wchar_t summary[1024];
wchar_t userlogin[1024];
wchar_t newId[256];
int _tmain(int argc, _TCHAR* argv[])
{
rtn = mksAPIInitialize(NULL);
rtn = mksCreateIntegrationPoint(&ip, "myserver",7001,0);
rtn = mksGetCommonSession(&session, ip);
rtn = mksCreateCmdRunner(&cr, session);
/* Setup defaults for the mksCmdRunner.*/
rtn = mksCmdRunnerSetDefaultHostname(cr, "myserver");
rtn = mksCmdRunnerSetDefaultPort(cr, 7001);
rtn = mksCmdRunnerSetDefaultUsername(cr, "IntegrationUser");
rtn = mksCmdRunnerSetDefaultPassword(cr, "secret");
MyCmd=mksCreateCommand();
MyCmd->appName = _T("im");
MyCmd->cmdName = _T("about");
MyResponse = mksCmdRunnerExecCmd(cr,MyCmd,NO_INTERIM );
MyResult = mksResponseGetResult(MyResponse);
MyItem = mksResultGetPrimaryValue(MyResult);
rtn = mksItemGetId(MyItem, newId, sizeof(newId));
rtn = mksGetError();
mksAPITerminate();
return 0;
}
What am i doing wrong ?
ok, i found it !
I have replaced
mksCreateIntegrationPoint(&ip, "myserver",7001,0); by mksCreateLocalAPIConnector(&ip,4,12,1);
And now it works fine !