users@jax-ws.java.net

Re: Connection timeout when changing ENDPOINT_ADDRESS_PROPERTY in runtime

From: Daniel Saavedra <dsaavedra_at_visual-tools.com>
Date: Tue, 10 Oct 2006 09:49:15 +0200

Hi,

Thanks for your reply Rick. I'm not working with JWSDP 1.x but with
JAX-WS. I'm aware of that functionality which includes reading the WSDL
when the connection object is created, but I can't implement my client
that way. The reason is that my server (actually an OPC XML-DA server)
does not allow to download the WSDL, it actually rejects every HTTP GET
method it receives. I have no access to the server, otherwise I would
rather change it so it accepts GET requests.

Therefore I use a local copy of a WSDL that I know my server complies
to, generate the code with wsimport and then during runtime change the
ENDPOINT_ADDRESS_PROPERTY to point to my real server.

As you said, no comms takes places when the property is changed, so i
tried sending a small command and waiting for a reply to check if
there's really a server there. When another machine is in that address I
just get a ConnectionRefusedException which is a behaviour I like.
However when the machine is not reachable, I got two different kind of
behaviours. Aparentely if the address is not in my ARP list, I
inmediately get an UnreachableHostException. However, if that server
was reachable and right before sending the command route to host is
lost, the operation is block for around two minutes and finally throws
an NoRouteToHostException.

I know maybe this is maybe an unlikely situation to happen, but I would
rather not have to deal with unexpectedly long timeouts which could
block certain parts of the system.

When working directly with TCP Sockets this situation can be avoided by
setting a specific timeout for the connection to be established, so you
don't rely on the O.S timeouts for establishing a connection. Then my
question is if there is any property I could change that allows me to
specify that socket timeout without messing into JAX-WS source code.

Thanks for your time,

Daniel Saavedra.


Rick Jones wrote:

>I guess you're working with JWSDP 1.x to be using ENDPOINT_ADDRESS_PROPERTY?
>When you set up the endpoint address, you are just setting a property in one
>of the stub objects. No comms takes place. It's only when you call a method
>that your code attempts to contact the server, so you can't actually verify
>the server when setting the address.
>
>If you move to JAX-WS 2.x it uses a different model for establishing the
>connection, which includes reading the WSDL at the time the connection object
>is created. So you will catch an exception at this point if the server details
>are wrong. It's also easier to code, because you simply pass the service URL
>to the service proxy class' constructor.
>
>HTH
>Rick Jones
>
>
>Quoting Daniel Saavedra <dsaavedra_at_visual-tools.com>:
>
>
>
>>Hi All,
>>
>>I'm implementing a webservice client that sets the endpoint address with
>>the ENDPOINT_ADDRESS_PROPERTY after creating a Service Stub that points
>>to the localhost. I have no problems when the IP and port are correctly
>>set up. I even set the "com.sun.xml.ws.request.timeout" property to a
>>certain timeout, so I get SocketTimeoutException when my Server doesn't
>>reply on the specified time.
>>
>>However, when the IP and port are wrongly choosen, so no Server is up in
>>that address, I get no Exception when changing the
>>ENDPOINT_ADDRESS_PROPERTY. Moreover, when a Service method is executed
>>the timeout doesn't correspond to the one set with
>>"com.sun.xml.ws.request.timeout" but it last around three minutes and
>>throws a ConnectionException. I guess this is because my client is
>>unable to establish any TCP connection with the Server (as there is no
>>server in that ip address).
>>
>>So my question is if there is any property I could change to set a
>>different timeout for the connection instead of the three minutes. Also,
>>I would like to know if there's any way to force the change of
>>ENDPOINT_ADDRESS_PROPERTY to throw an Exception when no server is
>>available in that address.
>>
>>Thanks,
>>
>>Daniel.
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
>>For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>>
>>
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
>For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>
>
>
>