Extending HP Quality Center using Groovy and Jacob
-
06-03-2021 - |
Question
I am trying to interface with HP Quality Center using Groovy with a Jacob COM wrapper, but I am running into problems.
When I try to run the following code:
import com.jacob.activeX.ActiveXComponent
import com.jacob.com.*
def QCUrl = "http://qc.example.com/qcbin"
def QCcom = new ActiveXComponent("TDApiOle80.TDConnection")
def conQC = QCcom.getObject()
Dispatch.call(conQC, 'InitConnectionEx', QCUrl)
I get this exception:
com/jacob.com.ComFailException: Can't map name to dispid: InitConnectionEx
The HP Quality Center OTA makes it clear that InitConnectionEx
is the method that I am interested in; however, I feel like I am missing a step somewhere. Any help would be greatly appreciated.
Solution 2
After much google time, I have come to the fix to my issue. The error was happening because I was not starting SoapUI with Admin rights.
Apparently, if the application you are running does not have admin rights, then it cannot create the necessary ActiveXObjects. When I would try to instantiate an ActiveXObject, I would not get any error, but the TDConnection object wasn't created and therefore InitConnectionEx was not present.
After starting SoapUI with admin rights, I am able to connect.
I got the idea from reading this article.
OTHER TIPS
I once had the questionable pleasure to work with Quality Center and its API. I didn't use Jacob directly, but the Groovy Scriptom module, which makes the COM scripting much more bearable. With Scriptom the code to connect to QC looks like this:
import org.codehaus.groovy.scriptom.*
Scriptom.inApartment
{
def tdc = new ActiveXObject ('TDApiOle80.TDConnection')
tdc.InitConnectionEx('http://qc.example.com/qcbin')
tdc.Login('user', 'password')
tdc.Connect('domain','project')
}