0

I have generated an CXF service and set timeouts for 120000ms = 2min for both:

requestContext.put("javax.xml.ws.client.receiveTimeout", 120000);
requestContext.put("javax.xml.ws.client.connectionTimeout", 120000);

It is working fine, I have tested it for 20s, 1min, 3min - everytime it is waiting for response exacly that amout of time.

However problem apears when I wanted to set it on 5min. Service is waiting for resposne only for ~240800ms = ~4min.

I'm calling jboss esb service. This one lasts max 5min. CXF service is called from inside of simple .jar application from my PC, so there is no other servers/containers between (like tomcat etc).

Any ideas to fix my timeout settings?

Using a Apache CXF 3.0.1

EDIT

What I realized now that I'm getting 2 diffrent messages depends on my timeout settings:

  • If I set it to <=4min (via my or @pedrofb method), after that amount of time I'm getting:

    org.apache.cxf.interceptor.Fault: Could not send Message. at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:516)

    Caused by: java.net.SocketTimeoutException: SocketTimeoutException invoking http://esb:8080/MyService/ebws/Category/MyService: Read timed out

  • if I set it to >4min or 0, I'm getting:

    javax.xml.ws.soap.SOAPFaultException: No response received for service [Category:MyService], Told not to retry.

To be honest, I'm pretty confused what is an expected result (first one, I think)

EDIT 2

I have tested MyService via SoapUI. I have set a 5min timeout there and shoot with sample request.

Again, after little more then 4 min I'm getting a:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
  <env:Fault>
     <faultcode>env:Server</faultcode>
     <faultstring>No response received for service [Category:MyService], Told not to retry.</faultstring>
  </env:Fault>
</env:Body>
</env:Envelope>

However when I look into log of Jboss ESB I have no exceptions, no errors, MyService last a 1 min more (about 5 min) and return normal response - which is confirmed by audit tool (which register every request to my esb - with response and time).

I think that this point on that what @pedrofb mentioned in comment. Any suggestions what this can be?

countryroadscat
  • 1,660
  • 4
  • 26
  • 49
  • Can the server be limiting the response to four minutes? – pedrofb Aug 08 '16 at 08:19
  • I have check that - service is responsing after about `4,5min` with normal, expected message, server timeout is set to `5 min` which confirms that – countryroadscat Aug 08 '16 at 08:35
  • 1
    Maybe your problem is similar to this http://rayploski.blogspot.com.es/2010/08/jbossesb-setting-up-long-running.html The client receives a timeout while the ESB continue processing. In this case it is needed to configure `org.jboss.soa.esb.ws.timeout` in ESB – pedrofb Aug 08 '16 at 11:51
  • @pedrofb Bingo! Param was set to exacly `240000`. Everything working perfectly well now. Can you edit your answer to let me accept it? Btw which method is better to set timeouts? Via `RequestContext` or like you posted via `HttpClientPolicy` – countryroadscat Aug 08 '16 at 12:42
  • Perfect, I'm glad!. I suggest to use CXF specific parameters, because in JIRA ticket they say that `RequestContext` parameters are not standarized and may change – pedrofb Aug 08 '16 at 12:58

1 Answers1

7

Maybe your problem is similar to this http://rayploski.blogspot.com.es/2010/08/jbossesb-setting-up-long-running.html The client receives a timeout while the ESB continue processing. In this case it is needed to configure org.jboss.soa.esb.ws.timeout in ESB

To configure client timeout, seems using requestContext parameters are not standarized see https://java.net/jira/browse/JAX_WS-1166. CXF team suggest they can change

Try using CXF specific parameters for timeout

Client client = ClientProxy.getClient(proxy);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(0);
httpClientPolicy.setReceiveTimeout(0);
http.setClient(httpClientPolicy);

The complete list of parameters is here. 0 means no timeout.

pedrofb
  • 37,271
  • 5
  • 94
  • 142
  • I've set my receive timeout to 300000ms (5 min) using this method. It's been 10 and it still hasn't timed out. Any ideas? – lovrodoe Jun 16 '21 at 11:30