And that's what I don't understand. You're doing essentially what I'm doing, but with 90 character parms instead of string objects.
Why does your work but mine doesn't? It makes no sense.
-----Original Message-----
From: Dan Kimmel <dkimmel@xxxxxxxxxxxxxxx>
To: Java Programming on and around the IBM i <java400-l@xxxxxxxxxxxx>
Sent: Tue, Mar 8, 2011 12:10 pm
Subject: RE: Signature mismatch when calling java prototype
'm goofing up terminology here: where I said member object, I should have said
nstance object.
-----Original Message-----
rom: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On
ehalf Of Dan Kimmel
ent: Tuesday, March 08, 2011 10:49 AM
o: Java Programming on and around the IBM i
ubject: RE: Signature mismatch when calling java prototype
Here's a working prototype.
* Create the workpiece
dcreateWorkpiece...
d pr 90a extproc(*java :
d 'com.rjssoft.workflow.util.+
d WorkpieceCreationInfo' :
d 'createWorkpiece')
d varying
d user 90a const varying
d password 90a const varying
It takes two byte array parameters and returns a byte array, all 90 characters
ong.
When this function is executed from RPG, the member object (newWorkpieceCreationInfo)
as already been created and is the first parameter passed. The return value is
ewWorkpieceID.
newWorkpieceID =
createWorkpiece...
(newWorkpieceCreationInfo :
%trim(checkinUser) :
%trim(checkinPassword) );
-----Original Message-----
rom: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On
ehalf Of mikemonger@xxxxxxx
ent: Tuesday, March 08, 2011 10:18 AM
o: java400-l@xxxxxxxxxxxx
ubject: Re: Signature mismatch when calling java prototype
ee, here's the funny part about that static keyword.
If I don't include it, the program won't compile unless I include the return
ariable as the first parameter in the prototype call.
But when I do that....I get the exact same error. And what's funny is that it
eports the same signature being sent (String,String)String. Which doesn't make
whole lot of sense to me, but, whatever.
I've never had problems calling java classes with prototypes in the past. But
his is the first time that I've actually tried to get something back from one.
And the issue doesn't seem to be whether to method is static or not in the
lass. I'm getting the same thing no matter how I define it.
-----Original Message-----
rom: Dan Kimmel <dkimmel@xxxxxxxxxxxxxxx>
o: Java Programming on and around the IBM i <java400-l@xxxxxxxxxxxx>
ent: Tue, Mar 8, 2011 11:07 am
ubject: RE: Signature mismatch when calling java prototype
otice that little word "static" in the definition of your "main" function?
his prototype is trying to invoke the method "main" on a member object. The
nction only exists in the class object. Thus, the error, no such method xists.
think there's a way to invoke a static method from RPG, but I've never tried
d don't know the syntax.
nother tip: Unless you want to go through another set of Java calls, declare
ur function to take and return byte arrays. Byte arrays work just fine in both
G and Java so you don't have to go through another set of calls to get the RPG
riable from the String.
o your java should look something like this:
byte[] myFunction( byte[] input){
return "Something".getBytes();
----Original Message-----
om: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On
half Of mikemonger@xxxxxxx
nt: Tuesday, March 08, 2011 9:11 AM
: java400-l@xxxxxxxxxxxx
bject: Signature mismatch when calling java prototype
Ok, I'm officially at my wits end. I've written a java class which accepts an
ray of string objects and returns a string. Here is the prototype in the RPG
ogram:
ResendOrder pr o extproc(*JAVA:
'com.WMS_BPCS_Integrator.ex-
ecutable.ResendOrder':'main')
class(*JAVA:'java.lang.String')
o class(*JAVA:'java.lang.String')
dim(2)
owever, when I call it, I'm receiving the following error:
ause . . . . . : RPG procedure GWBA09D5 in program MXMLIB/GWBA09D5 received
Java exception "java.lang.NoSuchMethodError: main" when calling method
"main" with signature "([Ljava.lang.String;)Ljava.lang.String;" in class
"com.WMS_BPCS_Integrator.executable.ResendOrder".
OW HERE'S THE FUNNY PART.
hen I pull up the class with javap -s, here's what I get for the signatures:
ublic class com.WMS_BPCS_Integrator.executable.ResendOrder extends
va.lang.Object{
blic com.DelMonte.WMS_BPCS_Integrator.executable.ResendOrder();
Signature: ()V
blic static java.lang.String main(java.lang.String[]);
Signature: ([Ljava/lang/String;)Ljava/lang/String;
otice how the signatures match? So do I.
his class works just fine as long as I don't try to RETRIEVE a parm. Removing
e return value from both the prototype and the class has the class running
rmally.
o...is it possible to actually prototype a java class so that it actually does
turn a value to the calling RPG program, or am I banging my head against the
ll for nothing?
've tried everything that I can think of so far. I even tried changing it to a
onstructor procedure and passing in the parms that way, but it really didn't
ke that.
-
is is the Java Programming on and around the IBM i (JAVA400-L) mailing list To
st a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or hange
ist options,
sit:
http://lists.midrange.com/mailman/listinfo/java400-l
email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to
view the archives at
http://archive.midrange.com/java400-l.
--
is is the Java Programming on and around the IBM i (JAVA400-L) mailing list o
ost a message email: JAVA400-L@xxxxxxxxxxxx o subscribe, unsubscribe, or change
ist options,
sit:
http://lists.midrange.com/mailman/listinfo/java400-l
email: JAVA400-L-request@xxxxxxxxxxxx
fore posting, please take a moment to review the archives t
ttp://archive.midrange.com/java400-l.
-
his is the Java Programming on and around the IBM i (JAVA400-L) mailing list To
ost a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
hange list options,
isit:
http://lists.midrange.com/mailman/listinfo/java400-l
r email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to
eview the archives at
http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.