Monday, 26 August 2013

API call not working on Linux

API call not working on Linux

I am trying to call a different server API using HTTPClient. I am
successfully able to call the API on my localbox, but when I call this API
from linux box, it is giving "java.net.ConnectException: Connection timed
out"
String searchBase = "http://username:password@dev.xxxx.xo/api/aaa;
HttpClient client = new HttpClient();
client.getParams().setAuthenticationPreemptive(true);
Credentials credentials = new UsernamePasswordCredentials("username",
"pass");
client.getState().setCredentials(AuthScope.ANY, credentials);
PostMethod post = new PostMethod(searchBase);
post.setRequestEntity(new StringRequestEntity(object.toString(),
"application/json", "UTF-8"));
Please Help me.

No comments:

Post a Comment