"); Variant response = Dispatch.call(d" /> "); Variant response = Dispatch.call(d" /> "); Variant response = Dispatch.call(d"/>

JACOB - Remote Dispatch call to COM Interface

1.1k Views Asked by At

I'm using JACOB in order to write message to a COM interface.

Dispatch dispatch = new Dispatch("<Interface Name>");
Variant response = Dispatch.call(dispatch, <DISPID>, message);

This works perfectly on localhost. But how can I use JACOB api to call interface on some other Machine/IP Address

1

There are 1 best solutions below

1
kunif On

JACOB seems to be unable to remotely access (DCOM call).

JACOB Project mailing-list FAQ

Can I call COM component across machines or operating systems?
The answer to this question is No. The way jacob is implemented is using JNI and a c++ DLL designed for the windows platform. COM is a binary standard defined by Microsoft as it hasn’t been ported over (as far as I know) to any other platforms yet. Jacob is only a java bridge for COM which defines how components talk to each other when they are on the same machine. The DCOM standard defines how components communicate across networks, but Jacob has no support for DCOM.

Solutions:

  • Commercial products, like J-Integra support the DCOM protocol natively.
  • Use RMI. Make a wrapper for the Jacob classes, and RMI'ify it. It actually works, but the Jacob lead didn't want to make the classes implement serializable, making the whole operation slightly difficult.
  • Use Web Services. Expose the stuff you'd like to have as a Web Service, and use SOAP and snacks on the Java side to access it.

Alternatively, it may be useful if the locally working COM object supports remote access internally.

It seems like the following article.

Jacob connect to Remote Computer for WMI support

ADODB Recordset Example

The JACOB Project: A JAva-COM Bridge

Downloads
The JACOB binary distribution (jacobBin_XX.zip) includes:

  1. jacob.jar: a JAR file for the java classes which you must add to your CLASSPATH. The package names replace com.ms with com.jacob (for example com.ms.com.Variant maps to com.jacob.com.Variant.
  2. jacob.dll: a small Win32 DLL which you must add to your PATH.
  3. samples: provided in Java source and compiled form to demonstrate various features of the product. In particular, a set of wrapper classes for Microsoft® ADO are provided as samples.

The source code is available in the JACOB source distribution (jacobSrc_XX.zip), which includes both the Java and C++ code. The source distribution is a superset of the binary one, so you don't need both.


Others seem to have other libraries, not JACOB.

A pure Java DCOM Bridge with j-interop

j-interop/j-interop/src/readme.htm


In Addition:

Similarly, it can not be called between computers connected via LAN.

Also, it is not possible to call local COM objects remotely with VC ++ or .NET language.

The workaround is to create a proxy application to call the local COM object on the remote computer.

Design the main application and the proxy application arbitrarily so that they can communicate with each other using a socket or other means.