permaculture playing cards*
The moose likes Web Services and the fly likes exception: java.net.ConnectException: Connection timed out: connect  while consuming a web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "exception: java.net.ConnectException: Connection timed out: connect  while consuming a web service" Watch "exception: java.net.ConnectException: Connection timed out: connect  while consuming a web service" New topic
Author

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

Ahuti Swapnadatwa
Greenhorn

Joined: Dec 15, 2010
Posts: 4
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

Joined: Jan 29, 2008
Posts: 61
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 ?


Thanks & Regards, Ravi C.Kota
SCJP 5.0, OCDJWS 5.0
Ahuti Swapnadatwa
Greenhorn

Joined: Dec 15, 2010
Posts: 4
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

Joined: Jan 29, 2008
Posts: 61
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

Joined: Feb 03, 2004
Posts: 576

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.


Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Ahuti Swapnadatwa
Greenhorn

Joined: Dec 15, 2010
Posts: 4
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

Joined: Feb 03, 2004
Posts: 576

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

Joined: Dec 15, 2010
Posts: 4
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: exception: java.net.ConnectException: Connection timed out: connect while consuming a web service
 
Similar Threads
Java Mail
Connection timed out
exception: java.net.ConnectException: Connection timed out: connect
Domain Address for JBOSS
FTPClient