• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SSL in Weblogic

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i am trying to connect to a payment gateway in my simple session bean using Weblogic 8.1 but it giving this error
com.datacash.client.errors.NetworkErrorReport: Network error
javax.net.ssl.SSLHandshakeException: FATAL Alert:HANDSHAKE_FAILURE - The
handshake handler was unable to negotiate an acceptable set of security paramet
ers.

does anyone have any idea how this error can be resolved...
regards,
Rizvi
 
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Can you provide more info on "payment gateway" and how do you connect to it. Is it an ejb that you are invoking or is it a HTTP URL connection that is being created
 
masroor rizvi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Rahul Mahindrakar
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
It looks like what you are doing is being encapsulated in agent.request method call.

Any how check out the link below and see if it helps you out
http://javaalmanac.com/egs/javax.net.ssl/TrustAll.html
 
Rahul Mahindrakar
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And this
http://www.javaworld.com/javatips/jw-javatip96_p.html
 
Rahul Mahindrakar
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And this
http://www.innovation.ch/java/HTTPClient/https.html
http://forum.java.sun.com/thread.jsp?forum=4&thread=206498&message=703066
[ August 22, 2003: Message edited by: Rahul Mahindrakar ]
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suggest checking out Jakarta Commons HttpClient. It has excellent support for things like https and web proxies.
 
masroor rizvi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the help mahendra....
i'll look into all these sites and see if things can works out for me...
thanks once again and regards,
Rizvi
 
Rahul Mahindrakar
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The solution provided by Chris is good. Try reusing Apache classes if you can.
 
Rahul Mahindrakar
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's an example
http://www.onjava.com/pub/a/onjava/2003/06/25/commons.html?page=3
 
I was born with webbed fish toes. This tiny ad is my only friend:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic