05-08-2015 03:25 AM
I'm trying to retrieve a List of Users from Teststand API with Java. Therefore I'm using an activex bridge (Jacob library). In this library I need a PRODID or a CLSID to instance it. I couldn't find this information anywhere in the help pages, forum, etc. So I tried to find out with the Microsoft OLE/COM Viewer I found 2 possiblities:
TestStand.Engine.1
TestStandRemoteEngine.RemoteEngine.1
I have also found the CLSID for each of them. I can connect with the remote API but not with the TestStand.Engine which I suppose is the correct on for my requirement. Here is the code:
ActiveXComponent sC = new ActiveXComponent("TestStand.Engine.1"); String result = Dispatch.call(sC, "GetUser", user).toString();
System.out.println(result);
sC.safeRelease();
The function I need is Engine.GetUser. I have already programmed a LabView VI which does this job, but I want to integrate this in a webservice for a bigger project.
Does anyone know the correct PROGID? Why is it not working? Anyone done this before? Any suggestions?
05-08-2015 08:27 AM
The way you are creating the engine is probably ok. Where I think you are hitting a problem is that GetUser doesn't return a string, it returns a different COM interface. You have to access the FullName property on that interface in order to get the name of the user as a string.
Hope this helps,
-Doug
05-08-2015 08:42 AM
Thank you Doug,
but the problem occurs before I try to call 'GetUser'. It already fails at the
ActiveXComponent sC = new ActiveXComponent("TestStand.Engine.1");
command. I don't know why this happens because if I put
ActiveXComponent sC = new ActiveXComponent("TestStandRemoteEngine.RemoteEngine.1");
there everything is ok. Unfortunately this is the wrong COM for retrieving a user. I don't know if this helps but the exception from the jacob lib says the following
com.jacob.com.ComFailException: Can't co-create object
As far as I understand this means there is an arbitrary connection problem. Which seems to make sense, because if I take another COM module (e.g. "Word.Application") it works fine.
05-08-2015 11:13 AM
@dt_tom wrote:
Thank you Doug,
but the problem occurs before I try to call 'GetUser'. It already fails at the
ActiveXComponent sC = new ActiveXComponent("TestStand.Engine.1");command. I don't know why this happens because if I put
ActiveXComponent sC = new ActiveXComponent("TestStandRemoteEngine.RemoteEngine.1");there everything is ok. Unfortunately this is the wrong COM for retrieving a user. I don't know if this helps but the exception from the jacob lib says the following
com.jacob.com.ComFailException: Can't co-create objectAs far as I understand this means there is an arbitrary connection problem. Which seems to make sense, because if I take another COM module (e.g. "Word.Application") it works fine.
Sorry I'm not familar with this Java API so I'm not sure why it's failing. Perhaps ActiveXComponent is the wrong class to use. Is there another class for different kinds of COM objects? Also you might try using the CLSID directly rather than the progid, but the progid should work too.
You might be getting a difference in behavior with the engine object because it is also technically an ActiveX control, though it doesn't require being created that way.
Hope this helps,
-Doug