Wednesday, January 27, 2021

FileNet API - Java code to get CE Connection using FileNet Content Engine API


FileNet Content Engine Connection


          A Connection is a fairly lightweight class. It tells the API how to connect to the Content Engine server. Because interactions between the API and the CE server are stateless from the point of view of the CE server, 
The below code is for Content Engine Server connection,

try{
      String contentenginURI = "http://<hostname>:<portnumber>/wsi/FNCEWS40MTOM/"; 
      String userName ="username"; 
      String password = "password"; 
      if(connectionObj==null){ 
      connectionObj = Factory.Connection.getConnection(contentenginURI); 
      Subject subject = UserContext.createSubject(connectionObj, userName, password, null); 
      UserContext uc = UserContext.get(); \\get UserContext Object and push the subject 
      uc.pushSubject(subject);    
     }
 }catch(Exception exe) { 
         exe.printStackTrace(); 
 }  

            A Connection object contains enough information to establish communication with the Content Engine server. This information is carried in a URI and includes the transport protocol (connection type), host name, and port number that are used for server communication. An incorrect configuration, such as an incompatibility between the environment and the information in the Connection object, is the most frequent cause of an exception that is related to a connection failure. 





No comments:

Post a Comment