Windchill Command Line Utility Skeleton

In the last topic Windchill Remote Method Server Access API we saw how we can use RemoteMethodServer to invoke method server code remotely. Even though there are plenty of utilities available in Windchill OOTB, we came across various scenarios where we need to write our own custom utilities.
In this post I am trying to share the Windchill command line utility skeleton which uses RemoteMethodServer.
package com.blogspot.maheshmhetre.windchill.utilities;

import java.lang.reflect.InvocationTargetException;
import java.rmi.RemoteException;

import wt.method.RemoteAccess;
import wt.method.RemoteMethodServer;
import wt.session.SessionHelper;
import wt.util.WTException;

public class WindchillCustomUtilitySkeleton {

 //START of inner class - Server
 public static class Server implements RemoteAccess {
  public static void methodOne(String param1, String param2) {
   try {
    //Get login credentials
    //Call core processing method
    WindchillCustomUtilitySkeleton utility = new WindchillCustomUtilitySkeleton(); 
    utility.doOperation(param1, param2);
   } catch (Exception e) {
 } //END of inner class - Server

 private void doOperation(String param1, String param2) throws WTException{
  //TODO execute your utility logic
  System.out.println("This sysout will be available in method server log.");
 public static void main(String[] args) {
  //TODO get utility input parameters
  //TODO basic validation

  System.out.println("This sysout will be available on console from where the utility is running.");
  //prepare input params
  //data types will depends on your method parameters and can be any valid object type
  Class argTypes[] = {String.class, String.class};//add all remote method parameter data types
  Object argValues[] = {"param_1_value", "param_2_value"};//respective data value
  //call remote method - pass inner class name, method name, arg types and arg values
  try {
     null, argTypes, argValues);
  } catch (RemoteException e) {
  } catch (InvocationTargetException e) {


Please share your thoughts to improve this skeleton.


Anonymous said...

Looking through the Javadoc for Windchill, I am having trouble finding anything that would allow me to upload a file to a known location in an existing Windchill database. This is my first foray into Windchill, and I may be using the wrong terminology or looking in the wrong place. Would you have any advice/recommendations as to where to look/what to use?

Anonymous said...

Hi Mahesh,

In the below code, i have to hard code username and Password which is not a best practice.

RemoteMethodServer rms = wt.method.RemoteMethodServer.getDefault();

Any workaround to avoid this?