How to invoke a C program from wm Enterprise 4.1?!

How do you all handle integrations where you need to invoke a C-based program (or APIs) on remote machines?!

What is the preferred solution for invoking C-programs?! Is there some type of adapter that you can deploy on a remote machine that houses the C-program, so you’re somehow able to invoke that program?!

It seems that we can’t get away from the multitude of these C-based dinosaurs - they’re everywhere and no good way to invoke them…

Some advice please -
James

Hi James,

The most straightforward way is probably to use the webmethods C api to create a broker client. The drawback to this is you end up writing a lot of code to handle all the things the adapter framework is designed to handle (security, remote administration, dynamic configuration, etc.). An alternative is to write an adapter in java with a jni interface to your C code.

Hope this helps,
Tara

I’m currently “QC” testing two C API Interfaces. Some of the key Learnings are:
1.) C service element is generated with a specification detailing API inputs & outputs:
out = cAPIJNI(Service.getSession(), in);
2.) Native Libraries are shared resources within the C service element:
static {
try {
//
/* Libraries needed by API */
/
/
System.loadLibrary(“nsl”);
System.loadLibrary(“C”);
System.loadLibrary(“Csup_v3”);
System.loadLibrary(“XXXXX”);
System.loadLibrary(“YYYYYY”);
System.loadLibrary(“ZZZZZZZZ”);
/***********************************/
System.loadLibrary(“packageName_folder_subfolder”);
Debug2.log(Debug2.LOG_MSG, Debug2.FAC_PACKAGE, Debug.ALL,
“Loading native library: wo2wo_wo_Vantive”);
} catch (UnsatisfiedLinkError e) {
Debug2.log(Debug2.LOG_MSG, Debug2.FAC_PACKAGE, Debug.ERROR,
e.getMessage());
}
}

native static Values cAPIJNI(Session session, Values in);
3.) Our C Resource was very pleased with the webMethods C documentation.
4.) Architecting the interface as an adapter would be tha better way to do it. If we had a spare Trading Partner Server license, we would have set the C API on it’s own environment and do a remote invoke from our Production B2B Environment.
5.) Last but not least, during development give the C developer their own B2B Server environment, develop the other flow services in the same package and use a Flow try/catch service to remote invoke the C API. This will allow others to do their development & testing while the C API Interface is tested and does it’s share of core dumping the B2B Server.

Hi,
I am actually trying out the second solution tara was suggesting - writing a Java Adapter and invoking the C function through JNI. I seem to have a problem in calling the function though.
As a standalone Java program, it runs fine, but when it is put inside the adapter code, it starts giving java.lang.UnsatisfiedLinkError.
The DLL(its in a Windows env) is loaded successfully, but the invokation fails!!
Any clue?
Thanks.

Please let me know more info on this. How to write a java service to invoke C Api’s at target systems

I need to invoke C++ Api’s from java services in webmethods in order to post data to a taget system. Has anyone used JNI calls in Webemthods to invoke C++ functions. Please share any sample code and tips for implementation.