By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,969 Members | 2,360 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,969 IT Pros & Developers. It's quick & easy.

Problem while calling a webservice using DNS name.

dmjpro
100+
P: 2,476
Have a look at my problem.
Expand|Select|Wrap|Line Numbers
  1. try{
  2.                 //String tokenLocatorUrl = "http://erp.iitkgp.ernet.in:80/SSO_Token_Object_locator/resources/getSSOToken";
  3.                 String tokenLocatorUrl = "http://10.29.33.96:80/SSO_Token_Object_locator/resources/getSSOToken";
  4.                 String file = "/APP/tomcat/apache-tomcat-6.0.14/webapps/SSOAdministration/WEB-INF/persistance/sso/9C148798C559E03C4E3EF20E9CE02485.worker2.obj";
  5.                 NameValuePair[] data = {new NameValuePair("Path", file)};
  6.                 HttpClient client = new HttpClient();
  7.                 HttpMethod method = new GetMethod(tokenLocatorUrl);
  8.                 method.setQueryString(data);
  9.                 int status_code = client.executeMethod(method);
  10.                 if(status_code != HttpStatus.SC_OK) out.println("Error!!!!");
  11.                 else out.println("Yahoo!!!!");
  12.             }catch(Exception e){
  13.                 e.printStackTrace(System.out);
  14.             }
  15.  
I am using commons-codec-1.3.jar, commons-httpclient-3.1.jar and commons-logging.jar three jar files.Now the code is running OK. And the web service also running OK.
Whenever i try to execute this code using domain name of 10.29.33.96 then it says ..
Expand|Select|Wrap|Line Numbers
  1. java.net.ConnectException: Connection refused: connect
  2.         at java.net.PlainSocketImpl.socketConnect(Native Method)
  3.         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
  4.         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
  5.         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
  6.         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
  7.         at java.net.Socket.connect(Socket.java:519)
  8.         at java.net.Socket.connect(Socket.java:469)
  9.         at java.net.Socket.<init>(Socket.java:366)
  10.         at java.net.Socket.<init>(Socket.java:239)
  11.         at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
  12.         at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
  13.         at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
  14.         at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
  15.         at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
  16.         at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
  17.         at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
  18.         at org.apache.jsp.index_jsp._jspService(index_jsp.java:81)
  19.         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
  20.         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  21.         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
  22.         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
  23.         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
  24.         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  25.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  26.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  27.         at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
  28.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  29.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  30.         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
  31.         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  32.         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
  33.         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  34.         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  35.         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
  36.         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
  37.         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
  38.         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
  39.         at java.lang.Thread.run(Thread.java:619)
  40.  
Why is it happening?
Feb 9 '09 #1
Share this Question
Share on Google+
3 Replies


10K+
P: 13,264
Is the port you are tying to access on 10.29.33.96 open and accepting connections?
Feb 9 '09 #2

Expert 10K+
P: 11,448
Try to ping that host (by name) and see if that IP address matches.

kind regards,

Jos
Feb 9 '09 #3

dmjpro
100+
P: 2,476
Both of you thanks :)
But when i send a plain request through the DNS name it's working at port 80.
But whenever the web service call made then it's not working.
Feb 10 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.