Not Able to consume external RestFul web service from Client in Eclipse or from restclient-ui

1.5k views Asked by At

I am not able to consume RESTful webservice from client. I have written in eclipse, even not able to consume it from restclient-ui, but can access sample RESTful web service which is running in my location web logic server. I am in Corporate/company Network. Getting error Connection Time out exception.

Error from restclient-ui as

Connection to http://api.openweathermap.org refused
org.apache.http.conn.HttpHostConnectException: Connection to http://api.openweathermap.org refused
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:127)
    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:147)
    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:108)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
    at org.wiztools.restclient.HTTPClientRequestExecuter.execute(HTTPClientRequestExecuter.java:303)
    at org.wiztools.restclient.ui.RESTView$26.run(RESTView.java:1061)
Caused by: java.net.ConnectException: Connection timed out: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:123)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:123)
    ... 7 more
1

There are 1 answers

1
ProgrAmmar On BEST ANSWER

Try setting your company's proxy using:

System.getProperties().put("https.proxyHost", "proxyHost");
System.getProperties().put("https.proxyPort", "proxyPort");

Similarly for http.