+ Reply to Thread
Results 1 to 7 of 7

Thread: RPG program & Calling JAVA methods - Ljava error

  1. #1

    Default RPG program & Calling JAVA methods - Ljava error

    JeffSaar wrote: > > We have created a RPG program that invokes a JAVA method that is receiving the error "NoSuchMethodError". The error points to a "(Ljava.lang.String" issue in the class we are using. > We created the proxy class using Websphere's Client proxy wizard by referencing the WSDL for the web service. Our java method and RPG prototype/procedure specifically references "java.lang.String" so I don't know where the Ljava is coming from. I think this is causing a signature issue. If anybody can give me some help with this it would be very much appreciated. Jeff, the L in Ljava.lang.String just means "Object". In the signature, most of the types are a single letter, I, F etc. For objects, the type is L followed by the class and a semicolon, so for java.lang.String, you get "Ljava.lang.String;" in the signature. Try doing a javap -s class on the class containing that method. javap will show the signatures of all the methods.

  2. #2

    Default RPG program & Calling JAVA methods - Ljava error

    Barbara, I assume you execute JAVAP in QSH? However, when I try it I receive the error below. javap -s -classpath /services/proxy/soap stockquoteProxy Error: Binary file 'stockquoteProxy' contains proxy.soap.stockquoteProxy I've rechecked my RPG prototype and have viewed the created JAVA source (from WDSL using Websphere client proxy wizard) and both use a parm of java string. I'm using Websphere's export function to move the proxy from our Websphere server to the IFS. Could some sort of translation be occuring that would cause this method/signature error? I haven't found much documentation on integrating RPG & JAVA. Where could I find information on types and how they relate to the signature? You mentioned that most are single letters such as I, F etc. Any help is appreciated. Jeff

  3. #3

    Default RPG program & Calling JAVA methods - Ljava error

    JeffSaar wrote: > > Barbara, > I assume you execute JAVAP in QSH? However, when I try it I receive the error below. > javap -s -classpath /services/proxy/soap stockquoteProxy > Error: Binary file 'stockquoteProxy' contains proxy.soap.stockquoteProxy > > I've rechecked my RPG prototype and have viewed the created JAVA source (from WDSL using Websphere client proxy wizard) and both use a parm of java string. I'm using Websphere's export function to move the proxy from our Websphere server to the IFS. Could some sort of translation be occuring that would cause this method/signature error? > > I haven't found much documentation on integrating RPG & JAVA. Where could I find information on types and how they relate to the signature? You mentioned that most are single letters such as I, F etc. > I did mean executing javap in QSH. I think you have to spell out the package for the class. javap -s proxy.soap.stockquoteProxy RPG's *JAVA support uses JNI. The mapping of Java types to method signatures is on this page of Sun's JNI tutorial: http://java.sun.com/docs/books/tutor...ng/method.html The mapping between Java types and RPG types is in the ILE RPG Programmer's Guide, in the Java section of the chapter called "RPG and the eBusiness World". If you post the Java method header and the RPG prototype, maybe we could spot the problem.

  4. #4

    Default RPG program & Calling JAVA methods - Ljava error

    Barbara, Below is the prototype but I'm not sure what is needed for the Java Method header. I was able to get JAVAP to work. Here it is. Compiled from "stockquoteProxy.java" public class proxy.soap.stockquoteProxy extends java.lang.Object { *** public proxy.soap.stockquoteProxy(); *** public synchronized void setEndPoint(java.net.URL); *** public synchronized java.net.URL getEndPoint(); throws java/net/MalformedURLException *** public synchronized org.w3c.dom.Element GetQuote_(org.w3c.dom.Element); throws java/lang/Exception *** public synchronized net.webservicex.GetQuoteResponseElement GetQuote(net.webservicex.GetQuoteElement); throws java/lang/Exception } PROTOTYPE ------------------------ /if defined(*CRTBNDRPG) H DFTACTGRP(*NO) /endif H BndDir('RPGWS/JNIUTIL') * FStockAFM CF E WorkStn * D makeProxy PR O ExtProc(*JAVA: D 'proxy.soap.stockquoteProxy' D *CONSTRUCTOR) * D GetQuote PR 4F ExtProc(*JAVA: D 'proxy.soap.stockquoteProxy' D 'GetQuote') D* CLASS(*JAVA:'java.lang.Float') D sym Like(makeString) CONST * D makeFloat PR O ExtProc(*JAVA: D 'java.lang.Float': D *CONSTRUCTOR) * D makeString PR O ExtProc(*JAVA: D 'java.lang.String': D *CONSTRUCTOR) D bytes 530A CONST VARYING * D sym S O CLASS(*JAVA:'java.lang.String') D tmp S O CLASS(*JAVA:'java.lang.String') D value S O CLASS(*JAVA:'java.lang.Float') D val S 4F D proxy S O CLASS(*JAVA: D 'proxy.soap.stockquoteProxy') * D env S * D rc S 10I 0 * D/Copy rpgws/srcopta,psds D/Copy rpgws/jnisrc,jniutil_p * * C Eval tmp = makeString('T') C Eval env = getJniEnv() C Eval rc=beginObjGroup(env: 10000) * C Eval proxy = makeProxy() * C DoW NOT *IN03 C Exfmt FMT01 * C If NOT *IN03 * C Monitor C Eval sym = makeString(%Trim(symbol)) C Eval quote = GetQuote(proxy:sym) C On-Error *ALL C Eval Status = %status C Status Dsply XX 1 C EndMon * C EndIf * C EndDo * * Free all objects C Eval rc=endObjGroup(env)

  5. #5

    Default RPG program & Calling JAVA methods - Ljava error

    JeffSaar wrote: > ... > public class proxy.soap.stockquoteProxy extends java.lang.Object { > public synchronized org.w3c.dom.Element GetQuote_(org.w3c.dom.Element); throws java/lang/Exception > > public synchronized net.webservicex.GetQuoteResponseElement GetQuote(net.webservicex.GetQuoteElement); throws java/lang/Exception > > } > ...> > * > D GetQuote PR 4F ExtProc(*JAVA: > D 'proxy.soap.stockquoteProxy' > D 'GetQuote') > D sym Like(makeString) CONST > * Jeff, there are two GetQuote methods in that Java class. The first returns the type "org.w3c.dom.Element" and has an "org.w3c.dom.Element" parameter. The second returns a "net.webservicex.GetQuoteResponseElement" and has a "net.webservicex.GetQuoteElement" parameter. Your RPG prototype is for a method that returns float and has a java.lang.String parameter. As far as I can tell, such a GetQuote method doesn't exist in the class you quoted. Your RPG prototype must match the Java method. You have to pick which GetQuote you want, and you have to tell the RPG compiler the correct return type and parameters. If there really is a GetQuote method that returns float and has a String parameter, it must be in some other class.

  6. #6

    Default RPG program & Calling JAVA methods - Ljava error

    We have created a RPG program that invokes a JAVA method that is receiving the error "NoSuchMethodError". The error points to a "(Ljava.lang.String" issue in the class we are using. We created the proxy class using Websphere's Client proxy wizard by referencing the WSDL for the web service. Our java method and RPG prototype/procedure specifically references "java.lang.String" so I don't know where the Ljava is coming from. I think this is causing a signature issue. If anybody can give me some help with this it would be very much appreciated. Thanks Jeff Saar

  7. #7

    Default RPG program & Calling JAVA methods - Ljava error

    Barbara, Yesterday I figured out I had downloaded the wrong WSDL. With the correct WSDL I was able to get my program to work! Talk about trial and error. I have never used any of this before let alone JAVA. My next step I need to tackle is how to define (in RPG) a JAVA proxy call that requires an array of primtive data types. Have you ever done this? Is there any RPG examples for this? Once again THANK YOU such much for your guidance. It's slow going but some of this is starting to make sense. Jeff Saar

+ Reply to Thread

Similar Threads

  1. Using RPG & JAVA classes - Ljava error
    By Jeff Saar in forum RPG
    Replies: 0
    Last Post: 08-16-2004, 01:20 PM
  2. Calling java methods from RPG program
    By bala@elektrisola.de in forum RPG
    Replies: 1
    Last Post: 08-10-2004, 07:52 AM
  3. RPGLE calling Java Methods using CODE400 SmartGuide
    By Guest.Visitor in forum Dev Tools
    Replies: 0
    Last Post: 05-28-2003, 11:57 AM
  4. calling an as400 program from java
    By tkosacek@visioninfo.com in forum Java
    Replies: 2
    Last Post: 10-18-2002, 07:05 AM
  5. Calling a JAva Program through a CL
    By dkeys@oreillyauto.com in forum Programming
    Replies: 2
    Last Post: 07-12-2001, 11:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts