javax.xml.ws.Response Java Examples
The following examples show how to use
javax.xml.ws.Response.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AsyncHTTPConduitTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testCallAsyncCallbackInvokedOnlyOnce() throws Exception { // This test is especially targeted for RHEL 6.8 updateAddressPort(g, PORT_INV); int repeat = 100; final AtomicInteger count = new AtomicInteger(0); for (int i = 0; i < repeat; i++) { try { g.greetMeAsync(request, new AsyncHandler<GreetMeResponse>() { public void handleResponse(Response<GreetMeResponse> res) { count.incrementAndGet(); } }).get(); } catch (Exception e) { } } Thread.sleep(1000); assertEquals("Callback should be invoked only once per request", repeat, count.intValue()); }
Example #2
Source File: SSLNettyClientTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testInvocation() throws Exception { setupTLS(g); setAddress(g, address); String response = g.greetMe("test"); assertEquals("Get a wrong response", "Hello test", response); GreetMeResponse resp = (GreetMeResponse)g.greetMeAsync("asyncTest", new AsyncHandler<GreetMeResponse>() { public void handleResponse(Response<GreetMeResponse> res) { try { res.get().getResponseType(); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } } }).get(); assertEquals("Hello asyncTest", resp.getResponseType()); MyLaterResponseHandler handler = new MyLaterResponseHandler(); g.greetMeLaterAsync(1000, handler).get(); // need to check the result here assertEquals("Hello, finally!", handler.getResponse().getResponseType()); }
Example #3
Source File: NettyHttpConduitTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testTimeoutAsync() throws Exception { updateAddressPort(g, PORT); HTTPConduit c = (HTTPConduit)ClientProxy.getClient(g).getConduit(); c.getClient().setReceiveTimeout(3000); c.getClient().setAsyncExecuteTimeout(3000); try { Response<GreetMeLaterResponse> future = g.greetMeLaterAsync(-5000L); future.get(); fail(); } catch (Exception ex) { //expected!!! } }
Example #4
Source File: GossipManagerBuilderTest.java From incubator-retired-gossip with Apache License 2.0 | 5 votes |
@Test public void testMessageHandlerKeeping() throws URISyntaxException { MessageHandler mi = new TypedMessageHandler(Response.class, new ResponseHandler()); GossipManager gossipManager = builder.messageHandler(mi).registry(new MetricRegistry()).build(); assertNotNull(gossipManager.getMessageHandler()); Assert.assertEquals(gossipManager.getMessageHandler(), mi); }
Example #5
Source File: ClientServerTest.java From cxf with Apache License 2.0 | 5 votes |
public void handleResponse(Response<GreetMeLaterResponse> response) { invocationCount++; try { GreetMeLaterResponse reply = response.get(); replyBuffer = reply.getResponseType(); } catch (InterruptedException | ExecutionException ex) { ex.printStackTrace(); } }
Example #6
Source File: ClientServerWebSocketTest.java From cxf with Apache License 2.0 | 5 votes |
public void handleResponse(Response<GreetMeLaterResponse> response) { invocationCount++; try { GreetMeLaterResponse reply = response.get(); replyBuffer = reply.getResponseType(); } catch (InterruptedException | ExecutionException ex) { ex.printStackTrace(); } }
Example #7
Source File: AsyncMethodHandler.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
protected final Response<Object> doInvoke(Object proxy, Object[] args, AsyncHandler handler) { AsyncInvoker invoker = new SEIAsyncInvoker(proxy, args); invoker.setNonNullAsyncHandlerGiven(handler != null); AsyncResponseImpl<Object> ft = new AsyncResponseImpl<Object>(invoker,handler); invoker.setReceiver(ft); ft.run(); return ft; }
Example #8
Source File: DispatchImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
public final Response<T> invokeAsync(T param) { Container old = ContainerResolver.getDefault().enterContainer(owner.getContainer()); try { if (LOGGER.isLoggable(Level.FINE)) { dumpParam(param, "invokeAsync(T)"); } AsyncInvoker invoker = new DispatchAsyncInvoker(param); AsyncResponseImpl<T> ft = new AsyncResponseImpl<T>(invoker,null); invoker.setReceiver(ft); ft.run(); return ft; } finally { ContainerResolver.getDefault().exitContainer(old); } }
Example #9
Source File: AbstractServerPersistenceTest.java From cxf with Apache License 2.0 | 5 votes |
void verifyServerRecovery(Response<GreetMeResponse>[] responses) throws Exception { // wait until all messages have received their responses int nDone = 0; long waited = 0; while (waited < 30) { nDone = 0; for (int i = 0; i < responses.length - 1; i++) { if (responses[i].isDone()) { nDone++; } } if (nDone == 3) { break; } Thread.sleep(500); waited++; } assertEquals("Not all responses have been received.", 3, nDone); // verify that all inbound messages are resent responses synchronized (this) { MessageFlow mf = new MessageFlow(out.getOutboundMessages(), in.getInboundMessages(), Names200408.WSA_NAMESPACE_NAME, RM10Constants.NAMESPACE_URI); int nOut = out.getOutboundMessages().size(); int nIn = in.getInboundMessages().size(); assertEquals("Unexpected outbound message(s)", 0, nOut); assertTrue(nIn >= 1); String[] expectedActions = new String[nIn]; for (int i = 0; i < nIn; i++) { expectedActions[i] = GREETME_RESPONSE_ACTION; } mf.verifyActions(expectedActions, false); } }
Example #10
Source File: DispatchClientServerTest.java From cxf with Apache License 2.0 | 5 votes |
public void handleResponse(Response<SAXSource> response) { try { reply = response.get(); } catch (Exception e) { e.printStackTrace(); } }
Example #11
Source File: TestAsyncHandler.java From cxf with Apache License 2.0 | 5 votes |
public void handleResponse(Response<GreetMeSometimeResponse> response) { try { System.err.println("handleResponse called"); reply = response.get(); } catch (Exception ex) { ex.printStackTrace(); } }
Example #12
Source File: AsyncMethodHandler.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
protected final Response<Object> doInvoke(Object proxy, Object[] args, AsyncHandler handler) { AsyncInvoker invoker = new SEIAsyncInvoker(proxy, args); invoker.setNonNullAsyncHandlerGiven(handler != null); AsyncResponseImpl<Object> ft = new AsyncResponseImpl<Object>(invoker,handler); invoker.setReceiver(ft); ft.run(); return ft; }
Example #13
Source File: JaxWsServiceConfiguration.java From cxf with Apache License 2.0 | 5 votes |
public Boolean isWebMethod(final Method method) { if (method == null || method.getReturnType().equals(Future.class) || method.getReturnType().equals(Response.class) || method.isSynthetic()) { return Boolean.FALSE; } WebMethod wm = method.getAnnotation(WebMethod.class); Class<?> cls = method.getDeclaringClass(); if ((wm != null) && wm.exclude()) { return Boolean.FALSE; } if ((wm != null && !wm.exclude()) || (implInfo.getSEIClass() != null && cls.isInterface() && cls.isAssignableFrom(implInfo.getSEIClass()))) { return Boolean.TRUE; } if (method.getDeclaringClass().isInterface()) { return hasWebServiceAnnotation(method); } if (implInfo.getSEIClass() == null) { return hasWebServiceAnnotation(method) && !Modifier.isFinal(method.getModifiers()) && !Modifier.isStatic(method.getModifiers()); } return implInfo.getSEIClass().isAssignableFrom(method.getDeclaringClass()); }
Example #14
Source File: ClientServerWebSocketTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testAsyncPollingCall() throws Exception { URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); assertNotNull(wsdl); SOAPService service = new SOAPService(wsdl, serviceName); Greeter greeter = service.getPort(portName, Greeter.class); updateGreeterAddress(greeter, PORT); long before = System.currentTimeMillis(); long delay = 3000; Response<GreetMeLaterResponse> r1 = greeter.greetMeLaterAsync(delay); Response<GreetMeLaterResponse> r2 = greeter.greetMeLaterAsync(delay); long after = System.currentTimeMillis(); assertTrue("Duration of calls exceeded " + (2 * delay) + " ms", after - before < (2 * delay)); // first time round, responses should not be available yet assertFalse("Response already available.", r1.isDone()); assertFalse("Response already available.", r2.isDone()); // after three seconds responses should be available long waited = 0; while (waited < (delay + 1000)) { try { Thread.sleep(500); } catch (InterruptedException ex) { // ignore } if (r1.isDone() && r2.isDone()) { break; } waited += 500; } assertTrue("Response is not available.", r1.isDone()); assertTrue("Response is not available.", r2.isDone()); }
Example #15
Source File: AsyncHTTPConduitTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testTimeoutAsyncWithPropertySetting() throws Exception { updateAddressPort(g, PORT); ((javax.xml.ws.BindingProvider)g).getRequestContext().put("javax.xml.ws.client.receiveTimeout", "3000"); try { Response<GreetMeLaterResponse> future = g.greetMeLaterAsync(-5000L); future.get(); fail(); } catch (Exception ex) { //expected!!! } }
Example #16
Source File: DispatchImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public final Response<T> invokeAsync(T param) { Container old = ContainerResolver.getDefault().enterContainer(owner.getContainer()); try { if (LOGGER.isLoggable(Level.FINE)) { dumpParam(param, "invokeAsync(T)"); } AsyncInvoker invoker = new DispatchAsyncInvoker(param); AsyncResponseImpl<T> ft = new AsyncResponseImpl<T>(invoker,null); invoker.setReceiver(ft); ft.run(); return ft; } finally { ContainerResolver.getDefault().exitContainer(old); } }
Example #17
Source File: DispatchClientServerTest.java From cxf with Apache License 2.0 | 5 votes |
public void handleResponse(Response<Object> response) { try { //response context shouldn't be empty even with fault response message assertTrue(response.getContext().size() != 0); reply = response.get(); } catch (Exception e) { //e.printStackTrace(); } }
Example #18
Source File: DispatchImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public final Response<T> invokeAsync(T param) { Container old = ContainerResolver.getDefault().enterContainer(owner.getContainer()); try { if (LOGGER.isLoggable(Level.FINE)) { dumpParam(param, "invokeAsync(T)"); } AsyncInvoker invoker = new DispatchAsyncInvoker(param); AsyncResponseImpl<T> ft = new AsyncResponseImpl<T>(invoker,null); invoker.setReceiver(ft); ft.run(); return ft; } finally { ContainerResolver.getDefault().exitContainer(old); } }
Example #19
Source File: JaxWsClientProxy.java From cxf with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private Object invokeAsync(Method method, final BindingOperationInfo oi, Object[] params) throws Exception { client.setExecutor(getClient().getEndpoint().getExecutor()); AsyncHandler<Object> handler; if (params.length > 0 && params[params.length - 1] instanceof AsyncHandler) { handler = (AsyncHandler<Object>)params[params.length - 1]; Object[] newParams = new Object[params.length - 1]; System.arraycopy(params, 0, newParams, 0, newParams.length); params = newParams; } else { handler = null; } ClientCallback callback = new JaxwsClientCallback<Object>(handler, this) { @Override protected Throwable mapThrowable(Throwable t) { if (t instanceof Exception) { t = mapException(null, oi, (Exception)t); } return t; } }; Response<Object> ret = new JaxwsResponseCallback<>(callback); client.invoke(callback, oi, params); return ret; }
Example #20
Source File: SSLNettyClientTest.java From cxf with Apache License 2.0 | 5 votes |
@Override public void handleResponse(Response<GreetMeLaterResponse> res) { try { response = res.get(); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } }
Example #21
Source File: DispatchImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public final Response<T> invokeAsync(T param) { Container old = ContainerResolver.getDefault().enterContainer(owner.getContainer()); try { if (LOGGER.isLoggable(Level.FINE)) { dumpParam(param, "invokeAsync(T)"); } AsyncInvoker invoker = new DispatchAsyncInvoker(param); AsyncResponseImpl<T> ft = new AsyncResponseImpl<T>(invoker,null); invoker.setReceiver(ft); ft.run(); return ft; } finally { ContainerResolver.getDefault().exitContainer(old); } }
Example #22
Source File: StatefulGreeterImpl.java From cxf with Apache License 2.0 | 4 votes |
public Response<GreetMeResponse> greetMeAsync(String requestType) { return null; }
Example #23
Source File: FaultToEndpointServer.java From cxf with Apache License 2.0 | 4 votes |
public Response<GreetMeLaterResponse> greetMeLaterAsync(long requestType) { return null; }
Example #24
Source File: GreeterImpl.java From cxf with Apache License 2.0 | 4 votes |
public Response<TestNillableResponse> testNillableAsync(String nillElem, int intElem) { return null; }
Example #25
Source File: AddNumberImpl.java From cxf with Apache License 2.0 | 4 votes |
public Response<AddNumbersResponse> addNumbers2Async(int number1, int number2) { return null; }
Example #26
Source File: DerivedGreeterImpl.java From cxf with Apache License 2.0 | 4 votes |
public Response<GreetMeLaterResponse> greetMeLaterAsync(long requestType) { return null; /*not called */ }
Example #27
Source File: GreeterSessionImpl.java From cxf with Apache License 2.0 | 4 votes |
public Response<PingMeResponse> pingMeAsync() { return null; }
Example #28
Source File: NotAnnotatedGreeterImpl.java From cxf with Apache License 2.0 | 4 votes |
public Response<TestNillableResponse> testNillableAsync(String nillElem, int intElem) { return null; }
Example #29
Source File: SessionAnnotationGreeterImpl.java From cxf with Apache License 2.0 | 4 votes |
public Response<PingMeResponse> pingMeAsync() { return null; }
Example #30
Source File: AddNumberImpl.java From cxf with Apache License 2.0 | 4 votes |
public Response<AddNumbersResponse> addNumbersAsync(int number1, int number2) { return null; }