Java API openCAMConnectionWithNamespace

Post Reply
image2x
Posts: 125
Joined: Tue Jun 02, 2009 7:05 pm
OLAP Product: TM1, PAX, PAW, SPSS
Version: 2.0.916.10 on RHEL
Excel Version: 2016
Location: Minneapolis, MN

Java API openCAMConnectionWithNamespace

Post by image2x »

I am attempting change a java TI process execute "wrapper" from mode 1 authentication to mode 4 (CAM Security).

IBM has provided a technote covering how to authenticate with CAM using C++ https://www-304.ibm.com/support/docview ... wg21418355

Code: Select all

C++ Example Connection with a CAMNamespace in Cognos 8 using TM1SystemServerConnectWithCAMNamespace :

TM1V voServerName = TM1ValStringW( hPool, (TM1_UTF16_T *)pszServerName, 0 );

TM1V voPasswd = TM1ValStringEncryptW( hPool, (TM1_UTF16_T*)pszPassword, 0 );

TM1V vArray[3];
vArray[0] = TM1ValStringW( hPool, (TM1_UTF16_T*)szCAMNamespace, 0 );        
vArray[1] = TM1ValStringW( hPool, (TM1_UTF16_T*)admin_login_name, 0 );
vArray[2] = voPasswd;
  
TM1V vCAMArgArr = TM1ValArray(hPool, vArray, 3);
TM1V vTmpServer = TM1SystemServerConnectWithCAMNamespace(hPool, voServerName, vCAMArgArr);
The Java prototype for the connection function is as follows:

Code: Select all

openCAMConnectionWithNamespace(java.lang.String serverName, java.lang.String connID, TM1Val vArgArr) 
It seems like the Java function utilizes a parameter, java.lang.String connID, that isn't used in the C++ approach. I don't see any TM1 java methods that return a connID nor does it seem like I'd have a connID before a connection is established.

Below is the authentication part of the modified wrapper. My guess is that it is failing due to an undefined connID.

Code: Select all

String TM1AdminHost = "tm1adminhost";
TM1AdminPort = 5494;
String TM1DataServer = "tm1server";
String TM1ConnID = "blah"; // ummm?

TM1Bean bean = new TM1Bean();
bean.setAdminHost(TM1AdminHost);
bean.setAdminPort(TM1AdminPort);

TM1Val pCAMArray = TM1Val.makeArrayVal(3);
pCAMArray.addToArray(new TM1Val("namespace"));
pCAMArray.addToArray(new TM1Val("user"));
pCAMArray.addToArray(new TM1Val("password"));

TM1Server tm1_server = bean.openCAMConnectionWithNamespace(TM1DataServer, TM1ConnID, pCAMArray);

Any thoughts on what the connID is supposed to be?

Thanks,
-- John
image2x
Posts: 125
Joined: Tue Jun 02, 2009 7:05 pm
OLAP Product: TM1, PAX, PAW, SPSS
Version: 2.0.916.10 on RHEL
Excel Version: 2016
Location: Minneapolis, MN

Re: Java API openCAMConnectionWithNamespace

Post by image2x »

IBM Support was able to assist.

The "connID" should be your TM1 UserID. This is the same ID that is also passed in the connection array. Additionally, the CAM password needs to be encrypted.

Here's the essentials:

Code: Select all

TM1Val TM1PASS = new TM1Val(TM1PWD);
TM1PASS.Encryption(true);
TM1Val pCAMArray = TM1Val.makeArrayVal(3);
pCAMArray.addToArray(0, new TM1Val(TM1NAMESPACE));
pCAMArray.addToArray(1, new TM1Val(TM1UID));
pCAMArray.addToArray(2, TM1PASS);
TM1Server tm1_server = bean.openCAMConnectionWithNamespace(TM1DataServer,TM1ConnID, pCAMArray);
-- John
Post Reply