|
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
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.