Search in sources :

Example 6 with Dispatch

use of jakarta.xml.ws.Dispatch 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 7 with Dispatch

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

the class DispatchHelloLiteralTest method testVoidAsyncPollXML.

// todo: this does not come back as source investigate
public void testVoidAsyncPollXML() throws Exception {
    Dispatch dispatch = getDispatchSource();
    Collection<Source> sourceList = makeMsgSource(voidMsg);
    Collection<Source> responseList = makeMsgSource(voidResponse);
    for (Iterator iter = sourceList.iterator(); iter.hasNext(); ) {
        Object sourceObject = iter.next();
        Response<Source> result = dispatch.invokeAsync(sourceObject);
        Source realResult = result.get();
        assertTrue(realResult != null);
        System.out.println("-----------------------------------------");
        System.out.println("Source Result = ");
        System.out.println(sourceToXMLString(realResult));
        System.out.println("-----------------------------------------");
    }
}
Also used : 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 8 with Dispatch

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

the class DispatchHelloLiteralTest method testVoidAsyncHandlerJAXB.

public void testVoidAsyncHandlerJAXB() {
    JAXBContext jc = null;
    VoidTest voidTest = null;
    VoidTestResponse voidTestResult = null;
    try {
        jc = createJAXBContext();
        voidTest = new VoidTest();
        voidTestResult = new VoidTestResponse();
    } catch (Exception jbe) {
        jbe.printStackTrace();
    }
    Dispatch dispatch = getDispatchJAXB();
    JAXBAsyncHandler handler = new JAXBAsyncHandler(voidTest);
    Future result = dispatch.invokeAsync(voidTest, handler);
    System.out.println("Response " + result.getClass().getName());
}
Also used : Dispatch(jakarta.xml.ws.Dispatch) Future(java.util.concurrent.Future) JAXBContext(jakarta.xml.bind.JAXBContext) WebServiceException(jakarta.xml.ws.WebServiceException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException)

Example 9 with Dispatch

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

the class DispatchHelloLiteralTest method kkktestHelloAsyncHandlerCancelInterruptJAXB.

/* public void testHelloAsyncHandlerCancelJAXB() {

        JAXBContext jc = null;
        Hello_Type hello = null;

        try {
            jc = createJAXBContext();
            hello = new Hello_Type();

        } catch (Exception jbe) {
            jbe.printStackTrace();
        }

        try {
            hello.setExtra("Test ");
            hello.setArgument("Dispatch ");

            Dispatch dispatch = getDispatchJAXB();

            JAXBAsyncHandler handler = new JAXBAsyncHandler(hello);
            Future result = dispatch.invokeAsync(hello, handler);
            try {
                System.out.println("Response retured to test Thread " + Thread.currentThread().getId());
                System.out.println("Response " + result.getClass().getName());
            } catch (Exception ex) {
                ex.printStackTrace();
            }
            while (!result.isDone()) {
                System.out.println("Not done");
                result.cancel(false);
                assertTrue(result.isCancelled());
                System.out.println("Canceled result");
            }

        } catch (WebServiceException e) {
            e.printStackTrace();
        }
    }
   */
public void kkktestHelloAsyncHandlerCancelInterruptJAXB() {
    JAXBContext jc = null;
    Hello_Type hello = null;
    try {
        jc = createJAXBContext();
        hello = new Hello_Type();
    } catch (Exception jbe) {
        jbe.printStackTrace();
    }
    hello.setExtra("Test ");
    hello.setArgument("Dispatch ");
    Dispatch dispatch = getDispatchJAXB();
    JAXBAsyncHandler handler = new JAXBAsyncHandler(hello);
    Future result = dispatch.invokeAsync(hello, handler);
    while (!result.isDone()) {
        result.cancel(true);
        assertTrue(result.isCancelled());
        System.out.println("Cancel interupt passed");
    }
}
Also used : Dispatch(jakarta.xml.ws.Dispatch) Future(java.util.concurrent.Future) JAXBContext(jakarta.xml.bind.JAXBContext) WebServiceException(jakarta.xml.ws.WebServiceException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException)

Example 10 with Dispatch

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

the class DispatchHelloLiteralTest method testHelloAsyncHandlerJAXB2.

public void testHelloAsyncHandlerJAXB2() {
    JAXBContext jc = null;
    Hello_Type hello = null;
    try {
        jc = createJAXBContext();
        hello = new Hello_Type();
    } catch (Exception jbe) {
        jbe.printStackTrace();
    }
    Future result = null;
    hello.setExtra("Test ");
    hello.setArgument("Dispatch ");
    Dispatch dispatch = getDispatchJAXB();
    JAXBAsyncHandler handler = new JAXBAsyncHandler(hello);
    result = dispatch.invokeAsync(hello, handler);
    System.out.println("Response " + result.getClass().getName());
    int i = 0;
    while (!result.isDone()) {
        if (i == 1)
            System.out.println("Waiting for handler to complete 1");
        if (i == 500)
            System.out.println("Waiting for handler to complete 500");
        if (i == 1500)
            System.out.println("Waiting for handler to complete 1500");
        i++;
    }
    System.out.println("Handler is done ");
}
Also used : Future(java.util.concurrent.Future) Dispatch(jakarta.xml.ws.Dispatch) JAXBContext(jakarta.xml.bind.JAXBContext) WebServiceException(jakarta.xml.ws.WebServiceException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException)

Aggregations

Dispatch (jakarta.xml.ws.Dispatch)97 WebServiceException (jakarta.xml.ws.WebServiceException)41 Source (javax.xml.transform.Source)32 JAXBContext (jakarta.xml.bind.JAXBContext)30 SOAPFaultException (jakarta.xml.ws.soap.SOAPFaultException)27 MalformedURLException (java.net.MalformedURLException)24 JAXBException (jakarta.xml.bind.JAXBException)22 StreamSource (javax.xml.transform.stream.StreamSource)18 Service (jakarta.xml.ws.Service)16 DOMSource (javax.xml.transform.dom.DOMSource)13 SAXSource (javax.xml.transform.sax.SAXSource)13 InputSource (org.xml.sax.InputSource)13 SOAPMessage (jakarta.xml.soap.SOAPMessage)10 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)10 SAXException (org.xml.sax.SAXException)10 Response (jakarta.xml.ws.Response)9 Iterator (java.util.Iterator)8 URISyntaxException (java.net.URISyntaxException)7 WSEndpointReference (com.sun.xml.ws.api.addressing.WSEndpointReference)6 WSBindingProvider (com.sun.xml.ws.developer.WSBindingProvider)6