Setting the CXF WebService client timeout length

Source: Internet
Author: User
Tags set time xmlns

When using webservice, we usually set the request timeout limit in the client to avoid long-time connections to unavailable servers. In a CXF environment, the client can configure the time-out limit with two properties: Connectiontimeout-webservice is based on a TCP connection, which can be understood as the time setting of the TCP handshake, which exceeds the set time as a connection timeout. In milliseconds, The default is 30000 milliseconds, or 30 seconds. ReceiveTimeout-This property is the time to wait for a response after sending a WebService request, which is considered to be a response time-out over a set length. In milliseconds, the default is 60000 milliseconds, or 60 seconds.

There are two ways to configure the client:

One, set in the spring configuration file.

<?xml version= "1.0" encoding= "UTF-8"?> <beans xmlns= "Http://" xmlns:x Si= "Http://" xmlns:jee= "Http://" Xmlns:jax Ws= "Http://" xmlns:http-conf= "Http://" xsi:s chemalocation= "Http:// Spring-beans-2.0.xsd Http:// HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/JEE/SPR Ing-jee-2.0.xsd Http:// HTTP://CXF . ">  

Here are a few places to note:
1, need to specify http-conf namespace: Xmlns:http-conf=
2, specify the mode location: Http://
3. The Name property in Http-conf:conduit, specifying the service to which the setting is in effect. The Name property consists of the service's namespace, port name in the WSDL, and ". Http-conduit", such as {}helloworld.http- Conduit If you set the Name property to "*.http-conduit", all services will be in effect.

Second, through the Java code to set up. Alternatively: The server side can also be set to the spring code as follows: <!--set the response timeout limit on the server side, now using the default value of 30 seconds--
★ For more detailed configuration please refer to CXF official documentation:



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.