I use CXF 2.1.3 version. I had same problem with some older versions.
dkulp wrote: > > > Can I ask what version of CXF? I think one of the older versions of CXF > sufferred from something similar to this. I think the newer versions > work > better by forking a thread for the invoke, which is still not idea. > This > area does need a bit more work. There is a jira open for it: > https://issues.apache.org/jira/browse/CXF-1907 > just haven't had any time to really dig into it. > > > Dan > > > On Monday 26 January 2009 7:26:51 am Gox wrote: >> Hi >> >> I tried to invoke implementation of Provider web service asynchronously >> using invokeAsync methods of Dispatch but booth asynchronous methods >> blocks >> until response is received. i.e. invokeAsync work same as invoke method. >> >> Any help? >> >> >> This is client code >> >> >> >> >> Service service = Service.create(wsdlLocation, serviceName); >> >> Dispatch dispatch = service.createDispatch(portName, DOMSource.class, >> Service.Mode.PAYLOAD); >> >> Document doc = buildHelloRequest(); >> >> System.out.println("Request sent to WS"); >> Response response = dispatch.invokeAsync(new DOMSource(doc)); >> System.out.println("Going to wait for response..."); >> >> while(!response.isDone()) { >> System.out.println("Response not received yet, go to sleep 1000ms"); >> Thread.sleep(1000); >> } >> >> System.out.println("Response received"); >> >> Transformer transformer = >> TransformerFactory.newInstance().newTransformer(); >> transformer.setOutputProperty(OutputKeys.INDENT, "yes"); >> StreamResult result = new StreamResult(System.out); >> transformer.transform(response.get(), result); >> >> >> >> >> This is server code >> >> >> >> >> @WebServiceProvider(portName = "HelloMessagePort", >> serviceName = "HelloMessageService", >> >> targetNamespace="http://mycompany.com/ws/async/message") >> @ServiceMode(value = Service.Mode.PAYLOAD) >> public class HelloMessageProvider implements Provider { >> >> public DOMSource invoke(DOMSource request) { >> DOMSource response = null; >> try { >> >> Thread.sleep(3000); >> >> Document doc = buildHelloResponse(request); >> transformer.transform(new DOMSource(doc), result); >> >> response = new DOMSource(doc); >> >> } catch (Exception e) { >> e.printStackTrace(); >> } >> >> return response; >> } >> } > > > > -- > Daniel Kulp > [email protected] > http://dankulp.com/blog > > -- View this message in context: http://www.nabble.com/Asynchronous-methods-of-Dispatcher-don%E2%80%99t-working-tp21664592p21680283.html Sent from the cxf-user mailing list archive at Nabble.com.
