问题
We are using webservice consumer to hit a service hosted by 3rd party. While hitting the service, SocketTimeOutException happens after 16 minutes.
Our webservice consumer config is as given below.
<ws:consumer-config name="config_name"
wsdlLocation="${wsdlLocation}"
service="Service_name" port="service_portType"
serviceAddress="${serviceAddress}"
doc:name="Web Service Consumer" />
<ws:consumer config-ref="config_name" operation="test_operation"
doc:name="do_it" />
We have a default response timeout set at top of the configuration file.
<configuration defaultResponseTimeout="1000000" doc:name="Configuration" />
Now, when we asked the 3rd party about the time out, they asked us to set the SO_TIMEOUT of server to 0.
I know we can set it for https:connector with property 'serverSoTimeout="0"'. My question is how do we set it for Webservice consumer?
回答1:
This can be set by adding a parameter to your webservice endpoint like this: http://hostname:port/restoftheendpoint?responseTimeout=120000 Or This can be set up on the http listener global configuration attached to your wsconsumer config as below:
<ws:consumer-config name="test" wsdlLocation="test.wsdl" service="test" port="testSoap" serviceAddress="${test.endpoint}" doc:name="Web Service Consumer" connectorConfig="HTTP_Request_Config" />
<http:request-config name="HTTP_Request_Config" host="test" port="2000" responseTimeout="30000" doc:name="HTTP Request Configuration">
</http:request-config>
来源:https://stackoverflow.com/questions/38746014/setting-so-timeout-for-webservice-consumer-in-mule