User Service Mechanism in Teamcenter Customization













User Service Mechanism in Teamcenter Customization

You can use the UserService mechanism to call your ITK functions from Java in the rich client.

First register your ITK functions in the user_server_exits.c file.

Compile this file and your source code and link them into the libserver_exits library to make the functions available to the rich client.

  1. In the TC_ROOT\bin directory, back up your old library file (dll in Windows; or in UNIX or Linux).
  2. Copy the c and user_server_exits.h files from the TC_ROOT/sample/userservice directory to your working folder.
  3. Register your ITK functions in the c file.

    if you wanted to register an ITK function called PasteRevToNewstuff in the user_server_exits.c file,The File would look like figure 1-6.

#include <server_exits/user_server_exits.h>

#include <userservice.h>

extern DLLAPI int USERSERVICE_register_methods ()


int status = ITK_ok;

int iNumberOfArgs = 0;

int *piArgTypes = NULL;



* This function registers the server side user defined functions for the

* CORBA server



iNumberOfArgs = 2

piArgTypes = (int*) SM_alloc_persistent (iNumberOfArgs * sizeof (int));




USERSERVICE_register_method( “PasteRevToNewstuff”, PasteRevToNewstuff, iNumberOfArgs,piArgTypes,USERARG_TAG_TYPE);

return (status);


PLM: Introduction of Teamcenter Cloud

 user_server_exits.c file


If you want to use an array, add the + USERARG_ARRAY_TYPE declaration to the argument declaration.

For Example:- To make  the piArgTypes[1] argument in figure 1-6 a string array instead of only a string, change the line to this:


If you want to return the strings from the array, use the USERSERVICE_return_string_array function.

  1. If you are using Windows, compile your code and the c file using the compile.bat script in the TC_ROOT\sample directory with the following command:

%TC_ROOT%\sample\compile —DIPLIB=libserver_exits user_server_exits.c your-source-code.c


Introduction of Teamcenter Active Workspace Architecture

If you are using UNIX or Linux, see the Compiling section for the command.

  1. Link the server exits using the link_server_exits script in the TC_ROOT\sample directory with the following command:


  1. Copy the new library file to the TC_ROOT\bin

You can then call your ITK functions from the rich client.

For example:-

if you wanted to call the PasteRevToNewstuff function from a JPanel component within an application,

import java.lang.Object;

import java.awt.*;

import javax.swing.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import com.teamcenter.rac.aif.*;

import com.teamcenter.rac.aif.kernel.*;

import com.teamcenter.rac.kernel.*;

import com.teamcenter.rac.util.*;


public class NewAppApplicationPanel extends JPanel


JTextPane JTextPane1 = new JTextPane();

private AbstractAIFUIApplication application = null;

private TCSession  session = null;

private TCUserService  service = null;

private TCComponent  component = null;


public class NewAppApplicationPanel( AbstractAIFUIApplication app )


super (new BorderLayout());


application = app;

session = (TCSession)application.getSession();




service = (TCUserService)session.getUserService();


catch( TCException e )








this.add (JTextPane1, null);


add( “North”, app.getApplicationHeader());

Object objs[] = new Object[2];


String itemID = new String( “000001”);

String revID = new String( “A”);

objs[0] = itemID;

objs[1] = revID;



component = (TCComponent) “ACME_PasteRevToNewstuff”, objs);



catch( TCException e )


MessageBox msgBox = new MessageBox( e );

msgBox.setModal( true );

msgBox.setVisible( true );



public NewAppApplicationPanel()





}  catch( Exception e )





private void jbInit() throws Exception




We will more post on PLM TUTORIAL–>Teamcenter Customization in upcoming days.

Kindly provide your valuable comment on below Comment section and also have you any question kindly ask to ASK QUESTION in FORUM. Our Team will try to provide the best workaround.

Kindly subscribe to your Email-Id in ( and in case anyone wishes to contact for more information on this topic/query, please drop me a message/comments).

Leave a Reply

Your email address will not be published. Required fields are marked *