Search in sources :

Example 21 with Dispatch

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

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

the class DispatchHelloLiteralTest method testVoidOnewayRequestJAXB.

public void testVoidOnewayRequestJAXB() {
    JAXBContext jc = null;
    VoidTest voidTest = null;
    try {
        jc = createJAXBContext();
        voidTest = new VoidTest();
    } catch (Exception jbe) {
        jbe.printStackTrace();
    }
    Dispatch dispatch = getDispatchJAXB();
    try {
        dispatch.invokeOneWay(voidTest);
    } catch (Exception e) {
        fail("testVoidOnewayRequestJAXB with exception " + e.getMessage());
    }
}
Also used : 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)

Example 23 with Dispatch

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

the class DispatchHelloLiteralTest method testVoidOnewayRequestXML.

public void testVoidOnewayRequestXML() {
    Dispatch dispatch = getDispatchSource();
    Collection<Source> sourceList = makeMsgSource(voidMsg);
    for (Iterator iter = sourceList.iterator(); iter.hasNext(); ) {
        try {
            Object sourceObject = iter.next();
            dispatch.invokeOneWay(sourceObject);
        } catch (Exception e) {
            fail("testVoidOnewayRequestXML with exception " + e.getMessage());
        }
    }
}
Also used : Iterator(java.util.Iterator) Dispatch(jakarta.xml.ws.Dispatch) DOMSource(javax.xml.transform.dom.DOMSource) StreamSource(javax.xml.transform.stream.StreamSource) InputSource(org.xml.sax.InputSource) SAXSource(javax.xml.transform.sax.SAXSource) WebServiceException(jakarta.xml.ws.WebServiceException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException)

Example 24 with Dispatch

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

the class DispatchHelloLiteralTest method testHelloOnewayRequestXML.

public void testHelloOnewayRequestXML() {
    Dispatch dispatch = getDispatchSource();
    Collection<Source> sourceList = makeMsgSource(helloMsg);
    for (Iterator iter = sourceList.iterator(); iter.hasNext(); ) {
        try {
            Object sourceObject = iter.next();
            dispatch.invokeOneWay(sourceObject);
        } catch (Exception e) {
            fail("testHelloOnewayRequestXML with exception " + e.getMessage());
        }
    }
}
Also used : Iterator(java.util.Iterator) Dispatch(jakarta.xml.ws.Dispatch) DOMSource(javax.xml.transform.dom.DOMSource) StreamSource(javax.xml.transform.stream.StreamSource) InputSource(org.xml.sax.InputSource) SAXSource(javax.xml.transform.sax.SAXSource) WebServiceException(jakarta.xml.ws.WebServiceException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException)

Example 25 with Dispatch

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

the class DispatchHeaderTest method testEcho4SOAPMessage.

public void testEcho4SOAPMessage() throws Exception {
    init(endpointAddress, portQName, serviceQName, null);
    Dispatch dispatch = getDispatchSOAPMessage();
    assertTrue(dispatch != null);
    assertTrue(dispatch instanceof com.sun.xml.ws.client.dispatch.SOAPMessageDispatch);
    // not sure why doing this
    byte[] bytes = echo4RequestSM.getBytes();
    ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
    // not sure why doint that above
    Source source = makeStreamSource(echo4RequestSM);
    SOAPMessage message = getSOAPMessage(source);
    Object result = dispatch.invoke(message);
    // todo:need to check contents
    System.out.println("Printing out received header");
    assertTrue(result instanceof SOAPMessage);
    ((SOAPMessage) result).writeTo(System.out);
}
Also used : Dispatch(jakarta.xml.ws.Dispatch) SOAPMessage(jakarta.xml.soap.SOAPMessage)

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