hi rahul,
thanks for the help....
previously i was trying it with a simple session bean using weblogic 8.1. Then i made a simple
jsp and put that in an ear and tried that on weblogic. For this simple JSP also, its giving the same error. The payment gateway that i'm connecting is datacash and the url for that is "https://testserver.datacash.com/Transaction".I also tried a simple public static void main example from my command prompt which worked completely fine. Then on similar lines i made a JSP which failed completely. The code of jsp is giving below:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page import="com.datacash.util.XMLDocument,
java.util.Hashtable,
com.datacash.util.CardInfo,
com.datacash.errors.FailureReport,
java.io.IOException,
com.datacash.client.Agent,
com.datacash.logging.Logger,
com.datacash.logging.LogListener,
java.util.Random"%>
<HTML>
<HEAD>
<TITLE>Simple JSP Page</TITLE>
</HEAD>
<BODY>
<H2>Counting Fun</H2>
<%--<% for (int jj=1; jj<=10; jj++) { %>
<%= jj %><br>
<% } %>--%>
<%!
static final Random RANDOM = new Random(System.currentTimeMillis());
static
String getRandomRef ( ) {
long merchantRef;
do {
merchantRef = Math.abs(RANDOM.nextLong()) % 1000000000000L;
} while ( merchantRef < 100000 );
return merchantRef + "";
}
%>
<%
String hostname = "https://testserver.datacash.com/Transaction";
Agent agent = new Agent();
String client = "99141400", password = "Jw9MPHW", cardInfoPath = null;
boolean runErrors;
//String usage = getUsage();
Logger logger = new Logger();
logger.addLogListener(new LogListener() {
public void log ( String string ) {
System.out.print(string);
}
});
logger.startListening();
agent.setHost(hostname);
agent.setTimeout(60000);
/* First, let's create and send a transaction by
* setting all of the fields directly. */
XMLDocument xmldoc1 = null;
try {
/* Create a new blank XMLDocument */
xmldoc1 = new XMLDocument();
/* Set your client and password details, for your
*
test account */
xmldoc1.set("Request.Authentication.client", client);
xmldoc1.set("Request.Authentication.password", password);
/* Set some random merchant reference. Once you're live,
* you'll want to use something other than random, but it's
* good enough for the demonstration. */
xmldoc1.set("Request.Transaction.TxnDetails.merchantreference", getRandomRef());
/* Set an amount. You don't need to specify a currency if
* it is GBP, but we'll do so anyway to show you how to
* do it */
Hashtable amt = new Hashtable();
amt.put("currency", "GBP");
xmldoc1.set("Request.Transaction.TxnDetails.amount", "5.99", amt);
/* Now set the card number, expiry date and method */
xmldoc1.set("Request.Transaction.CardTxn.Card.pan",
"5473000000000007");
xmldoc1.set("Request.Transaction.CardTxn.Card.expirydate",
"05/07");
xmldoc1.set("Request.Transaction.CardTxn.method", "auth");
/* Now, we create a new CardInfo object which checks the
* data that we have put into the XML Document */
CardInfo cardInfo = new CardInfo(cardInfoPath, logger);
System.out.println("value of card info object " + cardInfo);
/* We now attach the CardInfo object to the XMLDocument object */
xmldoc1.setCardInfo(cardInfo);
/* Now we send the transaction to the server */
System.out.println("before request");
XMLDocument response2 = agent.request(xmldoc1, logger);
System.out.println("after request");
/* That's all there is to it, we now should have a new
* XMLDocument object with the response from the server. */
String status = response2.get("Response.status");
String authcode = response2.get("Response.CardTxn.authcode");
String dcref = response2.get("Response.datacash_reference");
String time = response2.get("Response.time");
String missingelement = response2.get("Response.missingelement");
/* We'll log them here, just to show you that the values
* are in the strings. Note the last item we tried to
* get does not actually exist, to show that you will get
* an empty string if the element is not in the document. */
logger.log("\n" +
"Status: " + status + "\n" +
"AuthCode: " + authcode + "\n" +
"DataCash Reference: " + dcref + "\n" +
"Time: " + time + "\n" +
"Missing Element: " + missingelement + "\n\n");
}
catch (FailureReport failureReport) { failureReport.printStackTrace(); }
catch (IOException ioe) { ioe.printStackTrace(); }
catch (org.jdom.JDOMException j) { j.printStackTrace(); }
%>
</BODY>
</HTML>
....do let me know if you want any other information besides this. and thanks again for the help..
regards,
rizvi