3

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.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
Josh Ripley
  • 239
  • 1
  • 5
  • 17

2 Answers2

2

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')
}
Christoph Metzendorf
  • 7,968
  • 2
  • 31
  • 28
  • Thank you for the response Christoph. I really like Scriptom's syntax over the bare Jacob interface. However, after getting everything setup and running the above code example, I am still getting the: `com.jacob.com.ComFailException: Can't map name to dispid: InitConnectionEx` error. Any advice? – Josh Ripley Nov 22 '11 at 17:17
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.

Josh Ripley
  • 239
  • 1
  • 5
  • 17