PDA

View Full Version : How to communicate with local C++ app?


dan.baumann
Sep 16th, 2004, 10:27 AM
Hi,

My webapp needs to communicate with a C++ application running on the same server. SOAP will most probably be too chatty, so I was wondering what other options I have.

Any ideas?

Dan

Mark Pollack
Sep 16th, 2004, 03:01 PM
Hi,

You might see if your JMS implementation supports a C/C++ binding. I'd first though make some measurements to see if using SOAP would not meet your performance requirements.

- Mark

jstrachan
Sep 17th, 2004, 04:00 AM
If you want something real simple, ActiveMQ has a REST API so you can perform HTTP POST / GET to send/receive messages on the JMS broker which avoids using a SOAP stack in C/C++ land.

http://activemq.codehaus.org/REST

Though SOAP is a good general solution for bridging the language divide and should be considered - but REST is a good quick solution if you need it.

dan.baumann
Sep 17th, 2004, 05:13 AM
Thanks guys, I'll be looking into both options.

The other thing that came to mind was to have the C++ team implement a Spring-managed bean using JNI, which could communicate with their app however they like. Does that sound reasonable?

Thanks for your time,
Dan

jstrachan
Sep 17th, 2004, 05:23 AM
If you're considering JNI then you could always embed a JVM inside the C/C++ process and talk JNI to some Java code (be it Spring POJOs, JMS API or a SOAP stack).

e.g. it'd be fairly trivial to embed a JVM inside the C/C++ process and talk JNI to the JMS API for example.

Another option is to use GCJ to compile, say, ActiveMQ's Java code into a native C library that could be linked directly into a C/C++ application and used directly. This is my favourite & cleanest option as it can avoid much of the JNI pain.