Example usage for javax.xml.ws Response getContext

List of usage examples for javax.xml.ws Response getContext

Introduction

In this page you can find the example usage for javax.xml.ws Response getContext.

Prototype

Map<String, Object> getContext();

Source Link

Document

Gets the contained response context.

Usage

From source file:org.ebayopensource.turmeric.runtime.tests.common.sif.tester.ServicePayloadExecutor.java

@SuppressWarnings({ "rawtypes", "unchecked" })
private void invokeAsyncPull(ExecutionScope scope, Service svc, List<Object> outParams) throws Exception {
    Dispatch dispatch = null;/*from w  w  w . ja  va 2  s .  c o m*/
    Response response = null;
    Object obj = null;
    try {
        dispatch = svc.createDispatch(operationName);
        if (useInParams) {
            response = dispatch.invokeAsync(message);
        } else {
            response = dispatch.invokeAsync(null);
        }
        while (!response.isDone()) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
                break;
            }
        }
        obj = response.get();
        outParams.add(obj);
        assertNotExpectingException();
        if (assertPayload != null) {
            byte payload[] = (byte[]) response.getContext().get("PAYLOAD");
            assertPayload.assertPayload(scope, svc, payload);
        }
        if (assertResponse != null) {
            assertResponse.assertResponse(scope, svc, new ResponseAssertableResponse(response));
        }
    } finally {

    }
}

From source file:org.ebayopensource.turmeric.runtime.tests.common.sif.tester.ServicePayloadExecutor.java

@SuppressWarnings({ "rawtypes", "unchecked" })
private void invokeAsyncPush(ExecutionScope scope, Service svc, List<Object> outParams) throws Exception {
    Dispatch dispatch = null;/*from w w w . j  a va2s .c  om*/
    Future future = null;

    try {
        dispatch = svc.createDispatch(operationName);
        GenericAsyncHandler handler = new GenericAsyncHandler<MyMessage>();

        if (useInParams) {
            future = dispatch.invokeAsync(message, handler);
        } else {
            future = dispatch.invokeAsync(null, handler);
        }

        while (!future.isDone()) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
                break;
            }
        }

        if (handler.hasError()) {
            throw (ExecutionException) handler.getError();
        }

        outParams.add(handler.get());

        Response response = handler.getResponse();
        assertNotExpectingException();
        if (assertPayload != null) {
            byte payload[] = (byte[]) response.getContext().get("PAYLOAD");
            assertPayload.assertPayload(scope, svc, payload);
        }
        if (assertResponse != null) {
            assertResponse.assertResponse(scope, svc, new ResponseAssertableResponse(response));
        }
    } finally {

    }
}