I've trouble setting jax-ws timeout. My code is:
@WebServiceClient(name = "VoipDBJDBCService", targetNamespace = "http://db.server.voipmeter.jextreme.eu/", wsdlLocation = "http://trace0.nyc.blinkmind.com:8080/voipdb?wsdl")
public class VoipDBJDBCService extends Service {
public VoipDBJDBCService(URL wsdlLocation) {
super(wsdlLocation, new QName("http://db.server.voipmeter.jextreme.eu/", "VoipDBJDBCService"));
}
@WebEndpoint(name = "VoipDBJDBCPort")
public VoipDB getVoipDBJDBCPort() {
return super.getPort(new QName("http://db.server.voipmeter.jextreme.eu/", "VoipDBJDBCPort"), VoipDB.class);
}
}
And the usage:
VoipDB db = new VoipDBJDBCService(new URL(url)).getVoipDBJDBCPort();
How do i Hook in timeouts ? I've found "solution" here: https://jax-ws.dev.java.net/guide/HTTP_Timeouts.html but I don't know where I shall hook it in. How to obtain proxy ? When I call getPort client tries to connect and then hangs forever if server is not responding.
UPDATE: This code is invoked from within applets init() method if that makes any difference.
You can cast your
VoipDB
object toBindingProvider
. So in the example in the link you've given just replaceproxy
bydb
and you're good to go.With Metro/Glassfish...
If you are using a Sun JRE, you can set the following system properties for default network connect and read timeouts (in milliseconds). I haven't tried these with the JAX-WS client, but they ought work there as well:
Addition: I missed your last part of the question where you said that you are doing this in an applet. If the applet is running with default permissions, you are probably not allowed to set the system properties.
This worked for me.
Here is one example