A co-worker gave me some Java code that he used to make some account changes in ITIM from a web app that he created. He used the ITIM Web Service. I thought that since he already had existing code from the app that he created that I could basically use it for my purposes from TDI. However, I noticed that I have problems with certain calls (e.g. exception thrown, but account suspension takes place) and other calls (e.g. getAttributes()) throws an exception that I can't recover from.
First, I confirmed that the Java works. Then I copied the code to an empty Javascript component in TDI. I then I 'Javascript-ized' the code so that it would work from TDI. Maybe I didn't do it correctly(?). Are there limitations on what you can do with Java from a Javascript component?
This is basically what I have in the component that does the suspend:
var accountDN;
var config;
var user;
var ws;
var itimSession;
var req;
var e;
try {
accountDN = new java.lang.String("eruid=abc123, ou=systemUser, ou=itim, ou=myorg, dc=itim");
config = new Packages.gov.treas.fms.itim.data.util.Configuration.getInstance();
user = config.getProperty(Packages.gov.treas.fms.itim.data.util.Configuration.WS_USER_KEY);
ws = Packages.gov.treas.fms.itim.ws.util.ITIMWSUtil.getITIMWs();
itimSession = ws.login(user, user);
req = ws.suspendAccount(itimSession, accountDN, java.util.Calendar.getInstance());
task.logmsg("req: " + req);
if (req != null) {
java.lang.System.out.println("Request ID: " + req.getRequestId());
} else {
java.lang.System.out.println("Req = null");
}
} catch (e) {
e.printStackTrace();
}
It throws a java.net.ConnectException when executing the ws.suspendAccount() statement:
Thu Nov 08 17:12:44 EST 2012 AxisFault
Thu Nov 08 17:12:44 EST 2012 faultCode: {
http://schemas.xmlsoap.org/soap/envelope/}Server.userException
Thu Nov 08 17:12:44 EST 2012 faultSubcode:
Thu Nov 08 17:12:44 EST 2012 faultString: java.net.ConnectException: Connection refused: connect
Thu Nov 08 17:12:44 EST 2012 faultActor:
Thu Nov 08 17:12:44 EST 2012 faultNode:
Thu Nov 08 17:12:44 EST 2012 faultDetail:
Thu Nov 08 17:12:44 EST 2012 {
http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: Connection refused: connect
Thu Nov 08 17:12:44 EST 2012 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:352)
...
However, if I go into ITIM I can see that the request was actually made and completes successfully.
I may end up trying to create a regular web service client in TDI, but this would be faster if I knew how to fix it in TDI.
Thanks in advance.
Michael