Java PayPal API integration through proxy server
Getting the below exception while integrating PayPal API with Java, based on the analysis the direct communication to the API is not enabled from the server and the communication should be directed via Proxy server.09:10:50.525 [main] ERROR com.paypal.base.HttpConnection - Retry No : 1...
09:11:54.577 [main] ERROR com.paypal.base.HttpConnection - Caught exception while handling error response java.net.ConnectException: Connection timed out
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.7.0_67]
Setting the proxy server in the API:
HashMap<String,String> config=new HashMap<String,String>();
config.put("http.UseProxy", "true");
config.put("http.ProxyPort", "80");
config.put("http.ProxyHost", "proxy.server.com");
config.put("http.ProxyUserName", null);
config.put("http.ProxyPassword", null);
APIContext context = new APIContext(clientId, clientSecret, "sandbox",config);
Change the values of ProxyHost, ProxyPort, ProxyUserName and ProxyPassword accordingly.
The communication will be success after this.
No comments:
Post a Comment