I am using org.springframework.ws.client.core.WebServiceTemplate
for making Web Service calls. How can i configure timeout for the call.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
If you want that kind of control, you can
HttpUrlConnectionMessageSender
and in theprepareConnection(HttpURLConnection)
method callUrlConnection.setReadTimeOut(int)
The below code worked for me.
If you are using Spring Webservices 2.1.0 version, You can set timeout using HttpComponentsMessageSender.
CommonsHttpMessageSender are deprecated and not recommended by Spring anymore.
The way I have it implemented, I define my WebServiceTemplate to use HttpComponentsMessageSender.
Values are in Milliseconds
Just Make sure you have in your pom file, you added the following
Since Spring Webservices 2.2, you can also use Spring's ClientHttpRequestMessageSender:
(no dependency to Apache HTTP Components required)
That's how I did:
This article will probably sort you out: http://onebyteatatime.wordpress.com/2009/03/19/how-to-set-socket-timeout-using-spring-webservicetemplate/
The way I have it implemented, I define my WebServiceTemplate to use CommonsHttpMessageSender:
Then, in code, I get the messageSender and set the timeout on it. You could equally do this in your xml.