Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exception: java.net.ConnectException: Connection timed out: connect while consuming a web service

 
Ahuti Swapnadatwa
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to consume the following web service by generating a client in Eclipse Helios.
http://www.webservicex.net/WS/WSDetails.aspx?CATID=2&WSID=9

when i try to invoke it gives me a the following exception.
exception: java.net.ConnectException: Connection timed out: connect

I have tried several things from google but none of them seem to respond. i can nopt even route the request through tcptrace.
Can anyone help???
 
Ravi C Kota
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahuti Swapnadatwa wrote:Hi,

I am trying to consume the following web service by generating a client in Eclipse Helios.
http://www.webservicex.net/WS/WSDetails.aspx?CATID=2&WSID=9

when i try to invoke it gives me a the following exception.
exception: java.net.ConnectException: Connection timed out: connect

I have tried several things from google but none of them seem to respond. i can nopt even route the request through tcptrace.
Can anyone help???


Is "http://www.webservicex.net/stockquote.asmx" the service you are trying to invoke? Have you tried accessing the service through eclipse webservice explorer? What is the error you see there.

How did you generate the client and please post your client code ? Also at what point you see ConnectException? What do you see in stack ?
 
Ahuti Swapnadatwa
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it is the same service that you're talking of. I am trying to use eclipse web services explorer.
I generated the client by right clicking on the WSDL file and selecting generate client. and then testing it using TestClient.jsp and invoking the getQuote() method. On the result page i get this exception. I also tried creating my own servlet and routing the request through the same by invoking the getQuote method in the stockQuoteSoapProxy class. But tht gave the same reply too.
The following is the StockQuoteServlet code:

package NET.webserviceX.www;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.xml.rpc.ServiceException;

/**
* Servlet implementation class StockQuoteServlet
*/
@WebServlet("/StockQuoteServlet")
public class StockQuoteServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* Default constructor.
*/
public StockQuoteServlet() {

}



protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(true);
StockQuoteSoapProxy stockQuoteSoapProxy = new StockQuoteSoapProxy();
String stockSymbol = request.getParameter("Stock");
//StockQuoteSoapStub stockStub = new StockQuoteSoapStub();
String result = stockQuoteSoapProxy.getQuote(stockSymbol);
session.setAttribute("StockResponse", result);
response.sendRedirect("Input.jsp");
}

}


I think I'm going wrong somewhere but don't know it exactly.
 
Ravi C Kota
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ahuti,

I have tried this URL, through eclipse webservice explorer, but I too get the connection refused exception. I tried SOAPUI and it also gives me same exception. So I'm thinking it is nothing wrong you are doing, but the endpoint service is not allowing any connections. Or may be Firewalls blocking to reach the service.

One thing which I really did not understand here why this is allowed when accessing through browser, but not through client.....

Let me know, if you figured this out, as I'm very curious on this issue.
 
Naren Chivukula
Ranch Hand
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ahuti/Ravi,
I think the problem you're reporting might be temporary.

I tried the service in SOAPUI and it works without any problem with both SOAP1.1 and SOAP1.2.

Here is the request I sent.


Response I got


For SOAP1.2 request and response, replace xmlns:soap namespace with http://www.w3.org/2003/05/soap-envelope.
 
Ahuti Swapnadatwa
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ravi/Naveen,

I have not been able to solve the problem yet. In the mean time, can anyone suggest any free web service to get current stock quotes for the BSE/NSE?

Naveen,

I get no response from SOAPUI as well. My resuqest is same as yours but I still get the same response.
Any help???
 
Naren Chivukula
Ranch Hand
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ahuti,
Not sure if you are still interested in this post. It could be a temporary problem with the service or bad internet service. If the request exceeds prescribed duration of time, the web service may time out. Not a helpful answer though!
 
Ahuti Swapnadatwa
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Naren,

I'm still interested as I haven't found the solution and it seems not just to be a temporary problem. It still persists. Moreover, I haven't been able to find any other free webservice which gives me the solution. Let me know if you have any.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic