Q: How do I set a timeout when using { { { WSDL2Java } } } stubs?

A: There is a setTimeout method on the org.apache.axis.client.Stub class, which is the class all emitted stubs extend.

Here is how to set the timeout given a service named Foo:

{{{ { { { FooServiceLocator loc = new FooServiceLocator(); } } }

The default timeout in Axis 1.1 and later is 60 seconds. Axis 1.0 did not have a default timeout (i.e. it defaulted to 0). This timeout value is set on the HTTP socket and is not a connection timeout, which requires implementation we do not have as of Axis 1.1.

Q: When I do setTimeout(15*10000) or more bigger,I still get the error below when I connect http url, but localhost url is ok: {{{ java.net.ConnectException: Connection timed out: connect

ction.java:512)         at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection  .java:489)         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon  nection.java:617) {{{ at java.net.URL.openStream(URL.java:913)

aderFactory.java:149)         at org.apache.xerces.readers.DefaultEntityHandler.startReadingFromDocume  nt(DefaultEntityHandler.java:491)         at org.apache.xerces.framework.XMLParser.parseSomeSetup(XMLParser.java:3  12) {{{ at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1080)

java:195) {{{ at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:322)

a:384) {{{ at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:245)

java.net.ConnectException: Connection timed out: connect {{{ at java.net.PlainSocketImpl.socketConnect(Native Method)

ction.java:512)         at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection  .java:489)         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon  nection.java:617) {{{ at java.net.URL.openStream(URL.java:913)

aderFactory.java:149)         at org.apache.xerces.readers.DefaultEntityHandler.startReadingFromDocume  nt(DefaultEntityHandler.java:491)         at org.apache.xerces.framework.XMLParser.parseSomeSetup(XMLParser.java:3  12) {{{ at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1080)

java:195) {{{ at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:322)

a:384) {{{ at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:245)

does there need some other setting?please tell me.Thanks.

AxisProjectPages/JavaTimeout (last edited 2009-09-20 23:32:52 by localhost)