Grails handling network connection stall

283 Views Asked by At

I am using Grails Ws-Client Plugin but my application waits for the SOAP response back from the server from which i am consuming web service and my application waits from this code

def proxy = webService.getClient(wsdlUrl)

This mostly occours when the server is down or net connection is slow.

the wait also continues in case the webservice is temporarily removed from the server and the url containing the wsdl is redirecting to home page of website when try to access on web browser.

How can i detect that the wsdl is present or not and how can i set timeout like property so that the wait for response exist for 10 seconds and then it stops waiting for response and code start executing normally in case of stall .

I also don't get any exception or error as well.

1

There are 1 best solutions below

0
On

Sounds like there's no read and/or connect timeouts set on the client by default. This should help if the web service is down: proxy.setConnectionTimeout(value_in_milliseconds)

I'm not sure about setting the read timeout though, which is what you'd see if the host was up and accepting connections but the web service wasn't available or not responding. The best solution we found for this was to use the Apache Commons HTTP client instead of the default client, which gave us much more granular configuration over the client's connection settings. It's possible they're in the WS-Client plugin also, but the relevant documentation (actually the GroovyWS documentation) doesn't appear to mention anything about read timeouts.