You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by atg roxx <at...@gmail.com> on 2012/02/09 13:19:57 UTC

How to implement requestTimeout in the spring-ws component

Hi Team,

I have a situation,

I have to send a request to a soap  based client using spring-ws component
using InOut pattern.

I have to wait for say 2 second and if I don't get any reply in that time
frame. I should do some  action.

In JMS component of camel we have requestTimeout  which I can use  to
configure this  2 second.  Do we have anything like that in
spring-ws component.


--cheers,
atgroxx

Re: How to implement requestTimeout in the spring-ws component

Posted by Babak Vahdat <ba...@swissonline.ch>.
Hi

In the meanwhile the JIRA ticket [1] has been resolved and the new option on
the Producer side you can make use of is called "timeout". See also the
documentation [2] for more details.

Now you should be able to provide a timeout option while invoking the
webservice as client and then simply just react on:

  onException(java.net.SocketTimeoutException)... 

If you want you can also already make use of this option now using the
snapshot repo [3].

[1] https://issues.apache.org/jira/browse/CAMEL-4998
[2] http://camel.apache.org/spring-web-services.html
[3]
https://repository.apache.org/content/repositories/snapshots/org/apache/camel/camel-spring-ws/2.10-SNAPSHOT/ 

Babak

--
View this message in context: http://camel.465427.n5.nabble.com/How-to-implement-requestTimeout-in-the-spring-ws-component-tp5469281p5473245.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to implement requestTimeout in the spring-ws component

Posted by Babak Vahdat <ba...@swissonline.ch>.
Hi

I already logged a ticket [1].

The only odd thing is that the Spring folks did only provide this option
[1] in case of commons-httpclient but forgot to do the same as the same
API was given by JDK 1.5 afterwards [3] so that we have to take care of it
inside Camel itself (java.net.HttpURLConnection &
javax.net.ssl.HttpsURLConnection).

[1] https://issues.apache.org/jira/browse/CAMEL-4998
[2] https://jira.springsource.org/browse/SWS-320
[3] 
http://docs.oracle.com/javase/6/docs/api/java/net/URLConnection.html#setCon
nectTimeout(int)

Babak

Am 09.02.12 17:12 schrieb "Claus Ibsen" unter <cl...@gmail.com>:

>Hi
>
>If possible it would be nice to setup timeout options on the
>camel-spring-ws out of the box. Without having to resort to custom WS
>templates.
>We do this for camel-http, camel-http4 and other components.
>
>
>
>On Thu, Feb 9, 2012 at 3:38 PM, Babak Vahdat
><ba...@swissonline.ch> wrote:
>> Hi,
>>
>> I haven't tried it by myself but I think the following should do the
>>trick:
>>
>> Define your own dedicated WebServiceTemplate inside your spring
>> Configuration which makes use of commons HttpClient [1] which
>> on it's turn provides the possibility to specify a timeout (see [2] &
>>[3])
>> and then reference that WebServiceTemplate
>> using the # notation [4] when you do invoke. And using the onException()
>> Clause you could react when timeout happens:
>>
>> onException(java.net.SocketTimeoutException)...
>>
>> [1]
>> 
>>http://static.springsource.org/spring-ws/site/reference/html/client.html#
>>client-transports
>> [2]
>> 
>>http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient
>>/params/HttpConnectionParams.html#setSoTimeout%28int%29
>> [3]
>> 
>>http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient
>>/HttpConnection.html
>> [4] http://camel.apache.org/spring-web-services.html
>>
>> Babak
>>
>> --
>> View this message in context:
>>http://camel.465427.n5.nabble.com/How-to-implement-requestTimeout-in-the-
>>spring-ws-component-tp5469281p5469610.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
>-- 
>Claus Ibsen
>-----------------
>FuseSource
>Email: cibsen@fusesource.com
>Web: http://fusesource.com
>Twitter: davsclaus, fusenews
>Blog: http://davsclaus.blogspot.com/
>Author of Camel in Action: http://www.manning.com/ibsen/



Re: How to implement requestTimeout in the spring-ws component

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

If possible it would be nice to setup timeout options on the
camel-spring-ws out of the box. Without having to resort to custom WS
templates.
We do this for camel-http, camel-http4 and other components.



On Thu, Feb 9, 2012 at 3:38 PM, Babak Vahdat
<ba...@swissonline.ch> wrote:
> Hi,
>
> I haven't tried it by myself but I think the following should do the trick:
>
> Define your own dedicated WebServiceTemplate inside your spring
> Configuration which makes use of commons HttpClient [1] which
> on it's turn provides the possibility to specify a timeout (see [2] & [3])
> and then reference that WebServiceTemplate
> using the # notation [4] when you do invoke. And using the onException()
> Clause you could react when timeout happens:
>
> onException(java.net.SocketTimeoutException)...
>
> [1]
> http://static.springsource.org/spring-ws/site/reference/html/client.html#client-transports
> [2]
> http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/params/HttpConnectionParams.html#setSoTimeout%28int%29
> [3]
> http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/HttpConnection.html
> [4] http://camel.apache.org/spring-web-services.html
>
> Babak
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-implement-requestTimeout-in-the-spring-ws-component-tp5469281p5469610.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: How to implement requestTimeout in the spring-ws component

Posted by Babak Vahdat <ba...@swissonline.ch>.
Hi,

I haven't tried it by myself but I think the following should do the trick:

Define your own dedicated WebServiceTemplate inside your spring
Configuration which makes use of commons HttpClient [1] which
on it's turn provides the possibility to specify a timeout (see [2] & [3])
and then reference that WebServiceTemplate
using the # notation [4] when you do invoke. And using the onException()
Clause you could react when timeout happens:

onException(java.net.SocketTimeoutException)...

[1]
http://static.springsource.org/spring-ws/site/reference/html/client.html#client-transports
[2]
http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/params/HttpConnectionParams.html#setSoTimeout%28int%29
[3]
http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/HttpConnection.html
[4] http://camel.apache.org/spring-web-services.html

Babak

--
View this message in context: http://camel.465427.n5.nabble.com/How-to-implement-requestTimeout-in-the-spring-ws-component-tp5469281p5469610.html
Sent from the Camel - Users mailing list archive at Nabble.com.