Example usage for javax.xml.ws Response get

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

Introduction

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

Prototype

V get() throws InterruptedException, ExecutionException;

Source Link

Document

Waits if necessary for the computation to complete, and then retrieves its result.

Usage

From source file:am.ik.categolj2.domain.service.book.BookServiceImpl.java

@Override
public List<BookDto> searchByTitle(String title) {
    List<BookDto> books = new ArrayList<>();

    try {//from ww  w  .  j ava2  s. c  o  m
        ItemSearchRequest requestForBooks = new ItemSearchRequest();
        requestForBooks.setTitle(title);
        requestForBooks.setSearchIndex("Books");
        Response<ItemSearchResponse> responseForBooks = searchBook(requestForBooks);

        ItemSearchRequest requestForForeignBooks = new ItemSearchRequest();
        requestForForeignBooks.setTitle(title);
        requestForForeignBooks.setSearchIndex("ForeignBooks");
        Response<ItemSearchResponse> responseForForeignBooks = searchBook(requestForForeignBooks);

        books.addAll(reseponseToBooks(responseForBooks.get()));
        books.addAll(reseponseToBooks(responseForForeignBooks.get()));
    } catch (ExecutionException | InterruptedException | WebServiceException e) {
        throw new SystemException(MessageKeys.E_CT_BO_9501, e);
    }
    return books;
}

From source file:am.ik.categolj2.domain.service.book.BookServiceImpl.java

@Override
public List<BookDto> searchByKeyword(String keyword) {
    List<BookDto> books = new ArrayList<>();

    try {/*  w w w . j  a  va  2 s  .c o  m*/
        ItemSearchRequest requestForBooks = new ItemSearchRequest();
        requestForBooks.setKeywords(keyword);
        requestForBooks.setSearchIndex("Books");
        Response<ItemSearchResponse> responseForBooks = searchBook(requestForBooks);

        ItemSearchRequest requestForForeignBooks = new ItemSearchRequest();
        requestForForeignBooks.setKeywords(keyword);
        requestForForeignBooks.setSearchIndex("ForeignBooks");
        Response<ItemSearchResponse> responseForForeignBooks = searchBook(requestForForeignBooks);

        books.addAll(reseponseToBooks(responseForBooks.get()));
        books.addAll(reseponseToBooks(responseForForeignBooks.get()));
    } catch (ExecutionException | InterruptedException | WebServiceException e) {
        throw new SystemException(MessageKeys.E_CT_BO_9501, e);
    }
    return books;
}

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;/*  w  w  w. ja  v a  2  s.c  om*/
    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 {

    }
}