这里我阻止了一个主题"非常简单",我无法获得响应解决方案提供商的支持。
我尝试使用Payline库(支付提供商),但事实并非如此。我没有做的是下载他们的库,创建一个测试他们的例子的类,但脚本返回以下异常:
获取信息,链接以查看下载的内容支付线:https://support.payline.com/hc/fr/articles/201001237-Kit-d-int%C3%A9gration-JAVA
例外:
Apr 30, 2015 9:56:06 AM com.experian.payline.ws.wrapper.DirectPayment doAuthorization
SEVERE: Error during doAuthorization call :
com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:117)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:194)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:122)
at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:123)
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626)
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585)
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570)
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467)
at com.sun.xml.internal.ws.client.Stub.process(Stub.java:308)
at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:163)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:135)
at com.sun.proxy.$Proxy20.doAuthorization(Unknown Source)
at com.experian.payline.ws.wrapper.DirectPayment.doAuthorization(DirectPayment.java:110)
at test.launch.main(launch.java:42)
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1979)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1086)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1359)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1343)
at sun.net.http://www.protocol.https.HttpsClien...ient.java:563)
at sun.net.http://www.protocol.https.AbstractDe...tion.java:185)
at sun.net.http://www.protocol.http.HttpURLConn...ion.java:1092)
at sun.net.http://www.protocol.https.HttpsURLCo...Impl.java:250)
at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:105)
... 15 more
和我的代码:
package test;
import java.util.Date;
import com.experian.payline.kit.utils.ConnectParams;
import com.experian.payline.ws.impl.DoAuthorizationResponse;
import com.experian.payline.ws.obj.Card;
import com.experian.payline.ws.obj.Order;
import com.experian.payline.ws.obj.Payment;
import com.experian.payline.ws.wrapper.DirectPayment;
public class launch {
public static void main (String[] args){
//System.setProperty("https.protocols", "TLSv1.2");
ConnectParams params = new ConnectParams(null, false, true, "**************", "***************");
DirectPayment directPayment = new DirectPayment(params);
System.out.println(params.getProxyPort());
Payment payment = new Payment();
payment.setAmount("990");
payment.setCurrency("978");
payment.setAction("101");
payment.setMode("CPT");
payment.setContractNumber("0001/1234567");
Order order = new Order();
Date dNow = new Date();
order.setRef("KIT_"+dNow.getTime());
order.setAmount(payment.getAmount());
order.setCurrency(payment.getCurrency());
java.text.SimpleDateFormat s = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm");
order.setDate(s.format(dNow));
Card card = new Card();
card.setType("CB");
card.setNumber("1111222233334444");
card.setExpirationDate("0118");
card.setCvx("123");
DoAuthorizationResponse res = directPayment.doAuthorization(payment, order, null, card, null, null, null, null);
System.out.println(res.getResult());
}
}
debug ssl
main, READ: TLSv1 Alert, length = 2
main, RECV TLSv1 ALERT: fatal, handshake_failure
%% Invalidated: [Session-1, SSL_RSA_WITH_RC4_128_MD5]
main, called closeSocket()
main, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
main, called close()
我正在搜索,我仍然无法纠正这个问题"握手失败"。
我在我的Mac和Debian服务器(Java 7 on 2)上测试了这段代码
感谢您的帮助
答案 0 :(得分:0)
您在问题中提到您使用过java 7。
您发布的链接表示兼容版本是Java 1.5和Java 1.6。代码已经过测试并正在使用这些版本。
请查看java 1.6。这可能很容易成为兼容性问题。
https://support.payline.com/hc/fr/articles/201001237-Kit-d-int%C3%A9gration-JAVA
兼容性套件
Windows XP Pro / Windows 7 Pro Tomcat 5.5和6.0.35 Java 1.5& 1.6