Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

RPG program & Calling JAVA methods - Ljava error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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.

      Comment


      • #4
        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)

        Comment


        • #5
          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.

          Comment


          • #6
            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

            Comment


            • #7
              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

              Comment

              Working...
              X