Pinned topic Problem using Applix.TM1.API in .Net to connect to TM1 Server
When I build the application on my workstation it connects successfully to the TM1 database and I am able to see the cubes, etc. However when I run the application on the machine that will host the web application, it fails to connect to the server. I am deploying the Applix.TM1.API.dll with the application so there is no problem accessing the TM1 API code.
The code looks like this:
TM1AdminServer adminServer = new TM1AdminServer("tm1hostmachine", "tm1adminserver");
TM1ServerInfo serverInfo = adminServer.Servers;
TM1Server server = serverInfo.Login("username", "password");
As I said, this works fine on my personal workstation but fails on the target machine.
Even on the target machine, the first line succeeds and the TM1AdminServer object is created successfully but the second line fails to return a valid TM1InfoServer object. It appears that the TM1ServerInfoCollection in the TM1AdminServer is empty.
Since the Servers collection was empty, I tried fully qualifying the server information by changing the second line to this:
TM1ServerInfo serverInfo = adminServer.Servers.GetServerInfo("tm1hostmachine", "databasename");
But this also returns null.
Note that I have a TM1 developer client installed on my workstation but not on the target machine.
Is there any way to tell the Applix TM1 .Net API the fully qualified path to the database? Is there a configuration file, .ini file, environment variable or registry value that the API is looking for that is missing from the target machine? Or will the the Applix TM1 .Net API only work on a machine that has the TM1 client installed?
Re: Problem using Applix.TM1.API in .Net to connect to TM1 Server2012-07-20T16:50:16ZThis is the accepted answer. This is the accepted answer.I added the log4net logger to see if Applix.TM1.API.dll would log any messages when this happens and here is the result.
ERROR Applix.TM1.API.Internal._TM1Main (null) - Failed attempt to connect to host hostname on port 5498 with SSLCertID tm1adminserver Message
TM1APIDOTNET Exception: - System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
I still would like someone to tell me definitively whether the problem is because the TM1 client needs to be installed on any machine that attempts to use the Applix TM1 .Net API, or whether there is another way to get the connection accepted.
Re: Problem using Applix.TM1.API in .Net to connect to TM1 Server2012-07-23T20:50:19ZThis is the accepted answer. This is the accepted answer.I heard back from IBM support who said, "in order to connect via the API to the TM1 server you will need to have the client installed on the machine you're running the application on as there are required libraries that are needed when installing the client."
That's what I suspected, but I was hoping for a workaround.
Bottom line is that in order to be sure that the certificate is validated and that the connection to the server succeeds, we need to have the TM1 client installed on the web server that will run the application.
AndyIsola 270006HG3C1 Post
Re: Problem using Applix.TM1.API in .Net to connect to TM1 Server2013-09-13T20:11:30ZThis is the accepted answer. This is the accepted answer.
You don't need the whole client. You just need Applix.TM1.API.dll and Applix.TM1.API.SSPI.dll (located in ~/Cognos/TM1/bin). When you add the API as a resource then publish the project, it should be packaged with it.
DigitalMeister2010 2700032VPY13 Posts
Re: Problem using Applix.TM1.API in .Net to connect to TM1 Server2013-09-16T04:29:41ZThis is the accepted answer. This is the accepted answer.
If you're using CAM, be mindful that you will need to use the CAM functions to connect to the library.
If you want to use TM1Crypt to encrypt the password for a predefined user, you "should" be able to link into those files from your use AES 256 encryption, basically emulating what TM1RunTI would have to use.
The location of the DLL will be dependent on the version you're using. TM1 10.1.x had the DLL for TM1 misplaced in the TM1Web folder. It looks like they put it in the correct folder for TM1 10.2 (the tm1api folder), but I still have test some of my code against it.
If you're using C#, I believe there is a method of dynamically loading the DLL; I just don't have the code readily available. But I know that's what was done in the past. PowerShell (which is basically .NET scripting) is able to dynamically load the DLL based on an input parameter that defines the location of the DLL.
Re: Problem using Applix.TM1.API in .Net to connect to TM1 Server2013-09-16T18:18:12ZThis is the accepted answer. This is the accepted answer.
Thanks to AndyIsola and DigitalMeister2010 for resurrecting this question. The question was based on some "proof of concept" console application project and the full application was never implemented. However, because of the renewed interest, I decided to see if the console app would run if I installed the TM1 client by installing TM1 Perspectives on the server. The answer is YES. Simply installing the TM1 Perspectives on the server allowed the console app to run and connect to the TM1 server (on a different machine) successfully.
At some later point I may test it using an MVC server application running under IIS which would have been the target application.
However, as I said, it was only a "proof of concept" investigation that never went further.
DigitalMeister2010 2700032VPY13 Posts
Re: Problem using Applix.TM1.API in .Net to connect to TM1 Server2013-10-13T14:23:12ZThis is the accepted answer. This is the accepted answer.
- RobertTanenbaum 270005H1KE
Sounds good... FYI, I was just running some PowerShell scripts that link to the .NET DLL for TM1. I had recently upgraded to TM1 10.2 and things stopped working. The issue appears to be because the DLL file is back in a normal folder, \tm1_64\tm1api\bin. Of course I'm going to have to fix alot of stuff now.