java - Discard Webservice call if no response in specified time -


how stop invoked webservice client program(java) if there no response server within specific time. if there no response server within specified time, need prepare error message , send message ui.

try {     applicationprocessrs = service.processapplication(applicationprocessrq); } catch ( applicationprocessfaultmsg e ) {     log.error( e.getmessage(), e ); } 

thanks,
ramakrishna k

if want set timeouts specific services, once you've created proxy need cast bindingprovider (which know already), request context , set properties. online jax-ws documentation wrong, these correct property names

myinterface myinterface = new myinterfaceservice().getmyinterfacesoap(); map<string, object> requestcontext = ((bindingprovider)myinterface).getrequestcontext(); requestcontext.put(bindingproviderproperties.request_timeout, 3000); // timeout in millis requestcontext.put(bindingproviderproperties.connect_timeout, 1000); // timeout in millis myinterface.callmyremotemethodwith(myparameter);

of course, horrible way things, create nice factory producing these binding providers can injected timeouts want.

note request_timeout / connect_timeout properties inherited sun-internal class com.sun.xml.internal.ws.developer.jaxwsproperties , (at least on 32-bit linux) javac 1.6.0_27 , javac 1.7.0_03 fail compile code (similar bugs.sun.com/view_bug.do?bug_id=6544224 )... need pass -xdignore.symbol.file javac make work


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -