Skip to main content

How can I set a Web Service Timeout

7 replies [Last post]
adaj21
Offline
Joined: 2011-05-19
Points: 0

Hello,
I am using Metro for Web Services in an applet that needs to gracefully handle network failures. Occasionally the network fails in the middle of a WebService call, which hangs forever waiting for the response from the server (checked a stack dump). The CXF2 stack has properties for connect and read time-outs, but they do not work for Metro. How can I set these time-outs in Metro?
Thanks...

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Miroslav Kos

check out this: http://metro.java.net/guide/ch05.html#http-timeouts

On 5.12.2012 20:24, forums@java.net wrote:
> Hello, I am using Metro for Web Services in an applet that needs to
> gracefully handle network failures. Occasionally the network fails in the
> middle of a WebService call, which hangs forever waiting for the response
> from the server (checked a stack dump). The CXF2 stack has properties for
> connect and read time-outs, but they do not work for Metro. How can I set
> these time-outs in Metro? Thanks...
>

adaj21
Offline
Joined: 2011-05-19
Points: 0

Thanks for the link. Does not work. Interface JAXWSProperties is not defined in the package I use(javax.xml.ws)

Miroslav Kos

Not sure, what you mean now - are you getting accessClassInPackage
RuntimeException? Is your applet signed?

You can use the value of the constant directly -
"com.sun.xml.ws.connect.timeout"

On 6.12.2012 16:26, forums@java.net wrote:
> Thanks for the link. Does not work. Interface JAXWSProperties is not
> defined
> in the package I use(javax.xml.ws)
>

adaj21
Offline
Joined: 2011-05-19
Points: 0

Perhaps I am on the wrong Forum. I thought we were using Metro, but now I am not so sure. My project does not have any jar that contains com.sun.xml.ws. We use classes in rt.jar (javax.xml.ws). For example, I use eclipse and as soon as I type com.sun.xml.ws it complains that it cannot resolve the type.
So if I am on the wrong forum, I do apologize for this post. But would appreciate a redirection to the correct forum.
Regards.

jungicz
Offline
Joined: 2004-08-17
Points: 0

correct property name in your case should be: com.sun.xml.internal.ws.developer.JAXWSProperties.CONNECT_TIMEOUT (or directly 'com.sun.xml.internal.ws.connect.timeout') - this comes from what is available in rt.jar

adaj21
Offline
Joined: 2011-05-19
Points: 0

Thank you jungicz.
I set the time-out using "com.sun.xml.internal.ws.developer.JAXWSProperties.CONNECT_TIMEOUT" and it worked as expected.
Where are these properties documented?

jungicz
Offline
Joined: 2004-08-17
Points: 0

I found nothing related to 'internal' package, therefore I filed http://java.net/jira/browse/JAX_WS-1103 to add it

Standard (RI) properties are documented ie here: http://jax-ws.java.net/nonav/2.2.7/javadocs/index-all.html