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
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:
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.
jacob.dll: a small Win32 DLL which you must add to your PATH.
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.
Related
I'd like to make an Online Game with Android.
I'm planning to make Server with IOCP model via C++. This should work fine, the problem is the client.
IOCP client example in C++ uses WSASyncselect or WSAEventSelect.
I couldn't find any Java examples that same work like async socket.
Questions:
Is there anything like WSASyncselect() in Java?
If not that, how could i do it?
The JDK 7 Windows implementation of the Java 7 "NIO.2" classes
AsynchronousSocketChannel
AsynchronousServerSocketChannel
AsynchronousFileChannel
call the WSA[...] functions of the Windows "Overlapped IO" API behind the scenes.
For more in-depth information check out the OpenJDK repository folders containing the implementation .java sources along with their corresponding .c native sources and JNI bindings
.
Does anyone know of a good JNI/Java wrapper for TAPI 2?
I need to interact with the Avaya phones on the desks of my users for a CRM web application (based on GWT), and all computers have a TAPI 2 driver already installed (no TAPI 3 driver is available). Unfortunately the phone server does not produce events for calls-in-progress in a centralised form, or provide an API for initiating calls centrally.
I plan to use a signed Java Applet in the background of the web app to connect via TAPI and interact with the GWT client code via GWTAI.
I found the JTAPI implementations XTAPI and GJTAPI - but they are convoluted (due to the big differences between JTAPI and TAPI), buggy, and don't implement all TAPI functionality (e.g. XTAPI only provides 2 lines of call info of the dozen available).
Helen Warn's C# Wrapper provides a fantastic wrapper for TAPI 2 in C#, that does exactly what I want, providing direct access to the simple TAPI 2 interface. The only problem is that embedding an ActiveX control in a web page is off-limits as we really don't want to be locked into IE!
So it looks like I'm going to have to port Helen Warn's wrapper to Java using JNI? (not a trivial task).
Any other ideas?
Despite similar-looking names, TAPI and JTAPI are two completely different APIs. With regards to Avaya, TAPI is used to control Avaya IP Office series PBX and softphone applications running off Communication Manager (formerly Definity) series PBX. JTAPI is, in fact, a Java implementation of Novell's TSAPI protocol that is used to control Avaya Communication Manager PBX directly (not via phones). Centralized event notification and call control is provided via Application Enablement Services gateway (formerly Avaya CT) with variety of protocols and APIs, including JTAPI.
Hope it was helpful.
Regards,
Alex.
You could try to use one of the following tools, among others, to make the task more trivial.
SWIG: http://www.swig.org/
JNA: http://jna.java.net/
JavaCPP: http://code.google.com/p/javacpp/
Being the author of the third there, I recommend that one :)
I have always been doing web applications in coldfusion, and not long ago, I needed to generate bar codes for a particular web app, so I searched and one of the results was:
http://ricardo.parente.us/2008/09/printing-barcode-from-coldfusion/
In this solution, coldfusion utilizes Java's barbecue library to generate barcodes
In coldfusions documentation, I have always been reading things like:
ColdFusion is built on a J2EE-compliant Java technology platform. This lets ColdFusion applications take advantage of, and integrate with, J2EE elements. ColdFusion pages can do any of the following:
Include JavaScript and client-side Java applets on the page.
Use JSP tags.
Interoperate with JSP pages.
Use Java servlets.
Use Java objects, including JavaBeans and Enterprise JavaBeans.
Or
ColdFusion lets you access and use Microsoft .NET assembly classes as CFML objects. CFML applications can use .NET assemblies in the following ways:
Directly access and control Microsoft products, such as Word, Excel, or PowerPoint.
Use existing .NET components.
Use .NET assemblies that you create to leverage features that are difficult to use or not available in ColdFusion or Java.
The .NET classes that your application uses do not have to be local; your ColdFusion application can access .NET components that are located on remote systems, even systems that are located outside your firewall. Also, the ColdFusion system does not require .NET run-time software installed to use remote .NET components, so ColdFusion running on a UNIX, Linux, Solaris, or OS-X system can access and use .NET assemblies.
It did not dawn on me what all this really meant until I found the tutorial on barbecue. I saw that it is like there are other whole worlds of possibilities out there.
I would like to know what other libraries are out there in the Jave/J2EE & .NET platforms that be handy in web application development, just as the barbecue lib was?
You can post any that you found useful, Greatly Appreciated!
In terms of J2EE - lots of libraries have been useful to us. For example:
EHCache (prior to CF9's
implementation)
GeoIP (for IP
resolution)
Cryptography (use of a JCE for integrating with a HSM)
Also: We make extensive use of 3rd party software, and often this software has an API in Java or examples in Java. We can use that right away in ColdFusion - often just by dropping a .jar file into the CF classpath.
Very powerful stuff - it's a whole other world of usefulness :-P
We make extensive use of the Apache POI library to generate Excel files.
http://github.com/notnoop/java-apns for Apple Push Notification
http://www.coldfusionjedi.com/index.cfm/2010/9/13/Guest-Post-Apple-Push-Notifications-From-ColdFusion-in-Ten-Minutes-or-Less
I need to use the logic contained in some java classes. I found JNI, but that project seems not updated recently.
Is there a way to use it in a Delphi native application? I use Delphi 2009.
A newer solution than JNI is JNA, which also supports callbacks from (Delphi) DLLs. I found it easy to use.
You could try j-interop.
The technique I should adopt is to build a COM wrapper of java business logic, and using this COM server from delphi throught interoperability.
Delphi can build a type library of a COM server, and you could istantiate the com server using this typelibrary. Type library is simply a wrapper of the server, exposing its interface to be used by delphi code.
The key to communicating with different platform softwares is called "interoperability".
You can find this also in .net versus win32. Tipically delphi code is win32 (exe or dll), and you can build communication protocol between delphi objects and .net assemblies or java bytecode using interoperability solutions.
With Java 6, it takes only a few lines of code to write a standalone web service server which then can be invoked from Delphi.
small step-by-step tutorial, using the free NetBeans IDE and Delphi:
Delphi and Java Integration using Web Services
more xamples:
http://www.theserverside.de/webservice-in-java/
http://www.torsten-horn.de/techdocs/jee-jax-ws.htm#Minimaler-Webservice
Embed the VM in the native code. This worked for me.
An example with c can be found here. http://java.sun.com/docs/books/jni/html/invoke.html
I very much doubt it. Delphi Code gets compiled into an executable while Java code is executed by a Virtual Machine. So unless you launch a complete Virtual Machine inside Delphi code I see no way to easily include the logics.
We would like to give access to some of our EJBs from Excel. The goal is to give an API usable from VBA.
Our EJBs are mostly Stateless Session Beans that do simple CRUD operations with POJOs.
Some possible solutions:
Exposing the EJBs as WebServices and create a VB/C# dll wrapping them,
Using Corba to access the EJBs from C#,
Creating a COM Library that uses Java to access the EJBs,
Pointers to frameworks for these solution or other ideas are welcome.
You could take a look at IIOP.NET, which addresses this issue.
If you have a fairly recent ejb container, the cheapest and easiest should be to expose your beans as web services and call it from VB/C#. This doesn't require any extra tool or library.
I work on an open source project called XLLoop - this framework allows you to expose POJO functions as Excel functions.
It consists of:
An Excel add-in (XLL), which communicates over TCP to:
A Java server/library, which invokes java methods.
You could embed this java function server in an EJB and have it deployed as part of your app server.
Back in the VB6/COM/DCOM times we used the suite J-Integra to accomblish this task. I have no experience with the .NET version though.
I highly recommend IKVM. It is a java byte code to .NET assembly compiler (i.e. JAR --> DLL) and I have used it to create live JMX links and listeners in an Excel automation server. It should not be difficult for you to create a .NET assembly of your EJB client stubs and supporting libraries.
//Nicholas
You could try Obba (I work on this project):
Obba is a Java object handler for spreadsheet applications.
It provides a bridge between spreadsheets and Java classes, such that spreadsheets can be used as graphical user interface for Java libraries. Accessing your Java library form the spreadsheet requires no glue code (no VBA needed, no special Java code needed). Objects are instantiated by their original constructor. Constructors and methods are invoked using a "by name" reflection. A spreadsheet-specific factory method is not necessary. Obba provides the functions to handle objects in spreadsheets.
The Java virtual machine providing the add-in may run on the same computer or a remote computer - without any change to the spreadsheet, i.e., object referenced in the spreadsheet can reside on remote Java virtual machine.