Search in sources :

Example 1 with Response

use of jakarta.xml.ws.Response in project metro-jax-ws by eclipse-ee4j.

the class DispatchHelloLiteralTest method testVoidAsyncPollJAXB.

/*Invalid test may not cancel
    public void testHelloAsyncPollCancelXML() throws Exception {
        Dispatch dispatch = getDispatchSource();
        Collection<Source> sourceList = makeMsgSource(helloMsg);
        Collection<Source> responseList = makeMsgSource(helloResponse);

        for (Iterator iter = sourceList.iterator(); iter.hasNext();) {
            Object sourceObject = iter.next();
            Response result = dispatch.invokeAsync(sourceObject);

            while (!result.isDone()) {
                result.cancel(false);
                assertEquals(true, result.isCancelled());
            }
        }
    }


    public void testHelloAsyncPollCancelInterruptXML() throws Exception {

        Dispatch dispatch = getDispatchSource();
        Collection<Source> sourceList = makeMsgSource(helloMsg);
        Collection<Source> responseList = makeMsgSource(helloResponse);

        for (Iterator iter = sourceList.iterator(); iter.hasNext();) {
            Object sourceObject = iter.next();
            Response result = dispatch.invokeAsync(sourceObject);

            while (!result.isDone()) {
                result.cancel(true);
                assertEquals(true, result.isCancelled());
            }
        }
    }
     --end invalid test*/
public void testVoidAsyncPollJAXB() throws Exception {
    JAXBContext jc = createJAXBContext();
    VoidTest voidTest = new VoidTest();
    VoidTestResponse voidTestResult = new VoidTestResponse();
    Dispatch dispatch = getDispatchJAXB();
    Response result = dispatch.invokeAsync(voidTest);
    Object obj = result.get();
    assertTrue(obj != null);
    assertTrue(obj instanceof VoidTestResponse);
    VoidTestResponse res = (VoidTestResponse) obj;
}
Also used : Response(jakarta.xml.ws.Response) Dispatch(jakarta.xml.ws.Dispatch) JAXBContext(jakarta.xml.bind.JAXBContext)

Example 2 with Response

use of jakarta.xml.ws.Response in project metro-jax-ws by eclipse-ee4j.

the class DispatchHelloLiteralTest method testHelloAsyncPollDoneXML.

// todo: object comes back as jaxb object investigate
public void testHelloAsyncPollDoneXML() throws Exception {
    Dispatch dispatch = getDispatchSource();
    Collection<Source> sourceList = makeMsgSource(helloMsg);
    Collection<Source> responseList = makeMsgSource(helloResponse);
    for (Iterator iter = sourceList.iterator(); iter.hasNext(); ) {
        Object sourceObject = iter.next();
        Response result = dispatch.invokeAsync(sourceObject);
        while (!result.isDone()) {
        }
        Object realResult = ((Response) result).get();
        assertTrue(realResult instanceof Source);
    }
}
Also used : Response(jakarta.xml.ws.Response) Iterator(java.util.Iterator) Dispatch(jakarta.xml.ws.Dispatch) InputSource(org.xml.sax.InputSource) DOMSource(javax.xml.transform.dom.DOMSource) StreamSource(javax.xml.transform.stream.StreamSource) SAXSource(javax.xml.transform.sax.SAXSource)

Example 3 with Response

use of jakarta.xml.ws.Response in project metro-jax-ws by eclipse-ee4j.

the class DispatchHelloLiteralTest method testHelloAsyncPollJAXBMult.

public void testHelloAsyncPollJAXBMult() throws Exception {
    JAXBContext jc = createJAXBContext();
    Hello_Type hello = new Hello_Type();
    HelloResponse helloResult = new HelloResponse();
    hello.setExtra("Test ");
    hello.setArgument("Dispatch ");
    Dispatch dispatch = getDispatchJAXB();
    Response result = dispatch.invokeAsync(hello);
    Response result2 = dispatch.invokeAsync(hello);
    Response result3 = dispatch.invokeAsync(hello);
    Response result4 = dispatch.invokeAsync(hello);
    Response result5 = dispatch.invokeAsync(hello);
    Response result6 = dispatch.invokeAsync(hello);
    Response result7 = dispatch.invokeAsync(hello);
    Response result8 = dispatch.invokeAsync(hello);
    Response result9 = dispatch.invokeAsync(hello);
    int k = 0;
    Response resultf = null;
    for (k = 0; k < 55; k++) {
        resultf = dispatch.invokeAsync(hello);
    }
    System.out.println("last k " + k);
    while (!resultf.isDone()) {
    }
}
Also used : Response(jakarta.xml.ws.Response) Dispatch(jakarta.xml.ws.Dispatch) JAXBContext(jakarta.xml.bind.JAXBContext)

Example 4 with Response

use of jakarta.xml.ws.Response in project metro-jax-ws by eclipse-ee4j.

the class DispatchHelloLiteralTest method testHelloAsyncPollDoneJAXB.

public void testHelloAsyncPollDoneJAXB() throws Exception {
    JAXBContext jc = createJAXBContext();
    Hello_Type hello = new Hello_Type();
    HelloResponse helloResult = new HelloResponse();
    hello.setExtra("Test ");
    hello.setArgument("Dispatch ");
    Dispatch dispatch = getDispatchJAXB();
    Response result = dispatch.invokeAsync(hello);
    while (!result.isDone()) {
    }
    Object obj = result.get();
    HelloResponse res = (HelloResponse) obj;
    assertEquals(res.getExtra(), hello.getExtra());
    assertEquals(res.getArgument(), hello.getArgument());
}
Also used : Response(jakarta.xml.ws.Response) Dispatch(jakarta.xml.ws.Dispatch) JAXBContext(jakarta.xml.bind.JAXBContext)

Example 5 with Response

use of jakarta.xml.ws.Response in project metro-jax-ws by eclipse-ee4j.

the class DispatchHello method testHelloRequestResponseJAXBandSource.

/* public void testStubPropertySoapUseActionNegative() {

        try {
            Hello stub = getDynamicStubDynamicServer();
            // get stub
            Boolean prop = (Boolean)((BindingProvider) stub).getRequestContext().get(BindingProvider.SOAPACTION_USE_PROPERTY);
             ((BindingProvider) stub).getRequestContext().get(BindingProvider.SOAPACTION_URI_PROPERTY);

        } catch (Exception ex) {

            if (ex instanceof WebServiceException) {
                System.out.println("Property test passes");
            }
        }
    }
    */
public void testHelloRequestResponseJAXBandSource() throws Exception {
    // test for bug 6194159
    JAXBContext jc = null;
    HelloResponse helloResult = null;
    Hello_Type hello = new Hello_Type();
    jc = createJAXBContext();
    try {
        hello.setArgument("foo");
        hello.setExtra("Test ");
        Dispatch dispatch = getDispatchJAXB();
        Dispatch dispatch2 = getDispatchSource();
        dispatch.getRequestContext().put("com.sun.xml.pw.testprop", "test");
        Response response = dispatch.invokeAsync(hello);
        if (!response.isDone()) {
            dispatch2.invokeAsync(makeStreamSource(helloMsg));
        }
        Object result = response.get();
        assertEquals(((HelloResponse) result).getExtra(), hello.getExtra());
        assertEquals(((HelloResponse) result).getArgument(), hello.getArgument());
    } catch (Exception jex) {
        fail("Expected HelloResponse go Exception");
    }
}
Also used : Response(jakarta.xml.ws.Response) Dispatch(jakarta.xml.ws.Dispatch) JAXBContext(jakarta.xml.bind.JAXBContext) MalformedURLException(java.net.MalformedURLException) URISyntaxException(java.net.URISyntaxException) WebServiceException(jakarta.xml.ws.WebServiceException) JAXBException(jakarta.xml.bind.JAXBException) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException)

Aggregations

Response (jakarta.xml.ws.Response)11 Dispatch (jakarta.xml.ws.Dispatch)9 JAXBContext (jakarta.xml.bind.JAXBContext)7 StreamSource (javax.xml.transform.stream.StreamSource)4 JAXBException (jakarta.xml.bind.JAXBException)2 WebServiceException (jakarta.xml.ws.WebServiceException)2 SOAPFaultException (jakarta.xml.ws.soap.SOAPFaultException)2 MalformedURLException (java.net.MalformedURLException)2 Iterator (java.util.Iterator)2 DOMSource (javax.xml.transform.dom.DOMSource)2 SAXSource (javax.xml.transform.sax.SAXSource)2 InputSource (org.xml.sax.InputSource)2 SOAPTestHandler (async.wsdl_hello_lit.client.handlers.SOAPTestHandler)1 AsyncHandler (jakarta.xml.ws.AsyncHandler)1 URISyntaxException (java.net.URISyntaxException)1 ExecutionException (java.util.concurrent.ExecutionException)1 Source (javax.xml.transform.Source)1