COM2Java

by kai on 01/11/2006



Today I’ve got some issues with bloody COM objects in ColdFusion. I have to say that I was able to avoid dealing with this type of third-party integration most of the time up to now – but in this particular situation for this particular client, there was just no other way.

I’ve received an .ocx file, which is basically an ActiveX control. This .ocx file had to be registered on the Windows server running ColdFusion – fine so far, regsvr32.exe did the job. It was more tricky to find out the class name to call from ColdFusion in the cfobject tag, but that turned out to be pretty straightforward after installing the Windows Resource Kit tools and using oleview.

Actually – I was able to create an instance of the control, but as soon as I used some of the getters/setters or even tried to call a method, it blew up. I did some ivestigation and during that I’ve come across a very interesting and helpful technote – and that’s basically the reason for writing this post. It is called: Accessing complex COM objects in ColdFusion MX using Java Stubs and describes how to use a tool called COM2Java in CF, which basically creates the java stub .java files for integrating complex COM objects in CF. Those .java files then have to be compiled into class files for being useable within ColdFusion. It’s amazing and it makes a lot of sense to have this little tool, I was pretty surprise about its existence though.

Well, anyway – the issue was another thing (my .ocx file needed a particular winsock control to be installed) – but good to have found the other information…

Comments on this entry are closed.

Previous post:

Next post: