× 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.



I haven't ever tried to do this, but I did notice your Java package 
definition does not match the class definition you are specifying in RPG.

Shouldn't you just be specifying the package qualified class name in RPG, 
as opposed to a physical path location?  And then the CLASSPATH would 
handle locating the physical class location?

Mark





"Shannon O'Donnell" <sodonnell@xxxxxxxxxxxxxxx>
Sent by: java400-l-bounces@xxxxxxxxxxxx
07/09/2003 02:54 PM
Please respond to Java Programming on and around the iSeries / AS400 
 
        To:     "Java Programming on and around the iSeries / AS400" 
<java400-l@xxxxxxxxxxxx>
        cc: 
        Subject:        Calling Java from RPG - CLASSPATH Problem?


Hi,

I have been able to successfully call a java app from a CL program, after 
much finagling of the CLASSPATH.

Now I want to do the same thing in RPGIV, but running into a CLASSPATH (I 
guess...) problem again.  I've included the code here since it's short, 
and hopefully someone will be able to point out an error or two I might be 
making. Basically though, when I run it, I get an error:  "...received 
Java exception:  "java.lang.NoClassDefFoundError:" when calling method 
"<init>" with signature "()V" in class 
"/QIBM/ProdData/Java400/verisign/payflowpro/Java/PFProJavaReturns".

Here's the java code and the RPG code. Both are short....

====================================================
import com.Verisign.payment.PFProAPI;
class PFProJavaReturns {
 // Set defaults
 static String HostAddress   = "test-payflow.verisign.com";
 static Integer HostPort = Integer.decode("443");
 static String ParmList      = "";
 static Integer Timeout = Integer.decode("30");
 static String ProxyAddress  = "";
 static Integer ProxyPort = Integer.decode("0");
 static String ProxyLogon    = "";
 static String ProxyPassword = "";
 static String ReturnResponse = "";

   public static void main(String InputParms[])
   {
    // Place the arguments in the correct variables

  try {
   HostAddress   = InputParms[0];
   HostPort       = Integer.decode(InputParms[1]);
   ParmList      = InputParms[2];
   Timeout       = Integer.decode(InputParms[3]);
   ProxyAddress  = InputParms[4];
   ProxyPort     = Integer.decode(InputParms[5]);
   ProxyLogon    = InputParms[6];
   ProxyPassword = InputParms[7];
  } catch (Exception e) { }

               PFProJavaReturns c = new PFProJavaReturns();
   }

   public PFProJavaReturns()
    {
      String responses = autCard();
    }

// *CONSTRUCTOR With ZERO Parms
  protected String autCard()
     { 
         PFProAPI pn = new PFProAPI();
        // Set the certificate path
 pn.SetCertPath("/QIBM/ProdData/Java400/verisign/payflowpro/java/certs/");
  // Call the client.
  pn.CreateContext(HostAddress,
                         HostPort.intValue(),
                         Timeout.intValue(),
                         ProxyAddress,
                         ProxyPort.intValue(),
                         ProxyLogon,
                         ProxyPassword);
  String rc = pn.SubmitTransaction(ParmList);
  ReturnResponse = rc;
  pn.DestroyContext();
  return ReturnResponse;
     }


// *CONSTUCTOR with All Parms

  protected String autCard(String args[])
     { 
         try {
   HostAddress   = args[0];
   HostPort      = Integer.decode(args[1]);
   ParmList      = args[2];
   Timeout       = Integer.decode(args[3]);
   ProxyAddress  = args[4];
   ProxyPort     = Integer.decode(args[5]);
   ProxyLogon    = args[6];
   ProxyPassword = args[7];
  } catch (Exception e) { }
 
   PFProAPI pn = new PFProAPI();
   // Set the certificate path
 pn.SetCertPath("/QIBM/ProdData/Java400/verisign/payflowpro/java/certs/");

  // Call the client.
  pn.CreateContext(HostAddress,
                         HostPort.intValue(),
                         Timeout.intValue(),
                         ProxyAddress,
                         ProxyPort.intValue(),
                         ProxyLogon,
                         ProxyPassword);

  String rc = pn.SubmitTransaction(ParmList);
  ReturnResponse = rc;
  pn.DestroyContext();
  return ReturnResponse;
 }
}
========================================
========================================

 And here's the RPGIV program to call it:


     H thread(*serialize) DFTACTGRP(*NO)
      * Declare object refernce variable
     D obj_ref         S               O 
CLASS(*JAVA:'/QIBM/ProdData/Java400/-
     D verisign/payflowpro/Java/PFProJava-
     D                                     Returns')
     D string          S               O   CLASS(*JAVA:'java.lang.String')

      * Prototype procedure to create java String object
     D newString       PR              O   EXTPROC(*JAVA:
     D                                             'java.lang.String':
     D                                             *CONSTRUCTOR)
     D                                     CLASS(*JAVA:'java.lang.String')
     D charParm                    2000A   CONST VARYING

      * Prototype procedure to instantiate 'PFProJava' class
     D PFProJava       PR              O
     D                                     EXTPROC(*JAVA:
     D '/QIBM/ProdData/Java400/-
     D                                     verisign/payflowpro/Java-
     D                                     /PFProJavaReturns':
     D                                             *CONSTRUCTOR)

      * Prototype procedure to accept the credit card info STRING Object
     D PFProAut        PR          2000a
     D                                     EXTPROC(*JAVA:
     D '/QIBM/ProdData/Java400/-
     D                                     verisign/payflowpro/Java-
     D                                     /PFProJavaReturns':
     D                                             'autCard')
     D stringParm                          LIKE(string)


     D Response        S           2000a   Varying
     D Input_String    S            100A   VARYING
     D OutResponse     S           2000a
     D Cmd             s           1024a
     D CmdString       S            200a
     D Cmds            PR                  ExtPgm('QCMDEXC')
     D   command                    200A   const
     D   length                      15P 5 const
     D Apost           S              1a   Inz('''')

      /Free

     // Define a test data string to send to Verisign

       Input_String ='test-payflow.verisign.com 443 '  +
       '"USER=myusernameokoko&VENDOR=&PARTNER=mypartne&PWD=mypwdidisok2' +
       '&TRXTYPE=S&TENDER=C&ACCT=4222222222222&EXPDATE=1209&AMT=14.42' +
       '&COMMENT=Good Customer&INVNUM=1234567890&STREET=5199 ' +
       'JOHNSON&ZIP=94588"' + ' 30';

     // Convert alphanumeric string to java String object
                   string = newString(Input_String);

     // Instantiate the 'PFProJava' class
                   obj_ref = PFProJava();

        //  Call the 'autCard' method in class 'PFProJavaReturns'
                     Response = PFProAut(obj_ref:string);

                     OutResponse = Response;

                     *Inlr = *On;

      /End-Free


Thanks in Advance!

Shannon O'Donnell

_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) 
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.




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.