cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Java api CmdRunner execute si about example always returns result null

Participant

Java api CmdRunner execute si about example always returns result null

Hello all,

I'm trying to work with the java api and I use the examples found on PTC_IntegrationsBuilderGuide_Integrity_11_2.pdf

 

IntegrationPointFactory integrationPointFactory = IntegrationPointFactory.getInstance();
try {
    IntegrationPoint integrationPoint = integrationPointFactory.createIntegrationPoint(hostName, port, APIVersion.API_4_16);
   
    Session session = integrationPoint.createNamedSession(null, null, userName, password);
   
    CmdRunner cmdRunner = session.createCmdRunner();
   
    Command cmd = new Command(Command.SI, "about");
   
    Response response = cmdRunner.execute(cmd);
   
    ...

 

what is wrong in my test code ? Is the session correctly created ?

 

 

 

5 REPLIES 5

Re: Java api CmdRunner execute si about example always returns result null

It is difficult to know without seeing the error message returned but there is another sample code block in knowledgebase article CS159760 which you could try.

Re: Java api CmdRunner execute si about example always returns result null

Many thanks, this example works fine. I have just a problem with giving the username and password to create the session. The tool I'm writing should work without specifying username/password. Is it possible to take username/password specified in the client preferences ? Like using im/si commands in the shell ?

Re: Java api CmdRunner execute si about example always returns result null

There are some server-side properties which allow you to define a default API user and password. Found in the <IntegrityServer>\config\properties\is.properties file:

 

mksis.apiSession.defaultUser=MyUser
mksis.apiSession.defaultPassword=MyPassword

 

Setting the above values will allow API connections to be made without explicitly defining user credentials in your code. This must be a valid user within Integrity and have the appropriate permissions for the operations you will be doing with your code. Note that making changes to the is.properties file requires an Integrity Server service restart before they are recognized.

Re: Java api CmdRunner execute si about example always returns result null

Thank you for your answer, but I don't need a generic user defined on the server properties. I have to use the user and password registered in the local ILM client (File/Preferences/...) to be sure to use the dedicated permissions and to have the right user registered in the history.

Re: Java api CmdRunner execute si about example always returns result null

I found a solution to connect using the default user/password defined in the ILM Client Preferences.

Just execute command si connect...

Announcements