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://www.springframework.org/schema/beans" xmlns:x Si= "Http://www.w3.org/2001/XMLSchema-instance" xmlns:jee= "Http://www.springframework.org/schema/jee" Xmlns:jax Ws= "Http://cxf.apache.org/jaxws" xmlns:http-conf= "Http://cxf.apache.org/transports/http/configuration" xsi:s chemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/ Spring-beans-2.0.xsd Http://www.springframework.org/schema/jee HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/JEE/SPR Ing-jee-2.0.xsd Http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd HTTP://CXF . apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd ">
Here are a few places to note:
1, need to specify http-conf namespace: Xmlns:http-conf=http://cxf.apache.org/transports/http/configuration.
2, specify the mode location: Http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd.
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 {http://apache.org/hello_world}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:
Http://cwiki.apache.org/CXF20DOC/client-http-transport-including-ssl-support.html