× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You could potentially call an RPG routine as a native method (JNI), and in that scenario, you could pass a Java object as a parameter. RPG could then call Java methods, or use APIs, to get data from the object.

The problem with JNI (aside from complexity) is that the Java code and RPG code will need to run in the same job on the same system. And unless you use the 6.1 features for multi-threaded access to RPG, you'll have to serialize the RPG call.

By contrast, JT400 and stored procedures both use interprocess communications, and run the RPG code in a separate job. They even allow you to call across the network from another system. But the disadvantage there is that you can't possibly pass an object, since an object is data in the computers memory, and memory can't shared across different processes. (Err... well, that's not entirely true... but in this scenario it can't.)

The normal way of doing this sort of thing outside the JNI arena is to encode the object in XML (or, less commonly, JSON) and pass it to the RPG, have the RPG work with the XML, then output a new XML that can be converted back into an object on the Java/PHP side. There are standard protocols for this, including SOAP (simple object access protocol), CORBA, et al.


On 11/30/2010 4:33 PM, Paul Holm wrote:

Is it possible to pass a complex object (Java or PHP) to RPG and have
RPG invoke various methods on the object? This could be either a Stored
procedure call or a JT400 program call or any other means.

If so, I see this giving us a way to generically pass input parameters
and other business objects for validation or workflow and custom
business logic without having to declare in/out for every single scenario.

Thanks, Paul Holm



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.