Search in sources :

Example 26 with Dispatch

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

the class DispatchHeaderTest method testEchoSource.

public void testEchoSource() throws Exception {
    init(endpointAddress, portQName, serviceQName, null);
    Source source = makeStreamSource(echoRequest);
    Dispatch dispatch = getDispatchSource();
    try {
        System.err.println("************Expected EXCEPTION***************");
        Object result = dispatch.invoke(source);
        assertTrue(result == null);
    } catch (Exception sfe) {
        System.err.println("************End Expected EXCEPTION***************");
        assertTrue(sfe instanceof SOAPFaultException);
    }
}
Also used : Dispatch(jakarta.xml.ws.Dispatch) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException) JAXBException(jakarta.xml.bind.JAXBException) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException)

Example 27 with Dispatch

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

the class DispatchHelloClientTest method testNoParamSOAPMessageSource.

public void testNoParamSOAPMessageSource() throws Exception {
    Dispatch dispatch = getDispatchSOAPMessageSource();
    Source source = makeStreamSource(helloSM);
    try {
        Object result = dispatch.invoke(null);
        assertTrue(result == null);
    } catch (Exception e) {
        assertTrue(e instanceof WebServiceException);
        System.out.println("Exception message " + e.getMessage());
    }
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException) Dispatch(jakarta.xml.ws.Dispatch) Source(javax.xml.transform.Source) MalformedURLException(java.net.MalformedURLException) WebServiceException(jakarta.xml.ws.WebServiceException) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException)

Example 28 with Dispatch

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

the class DispatchHelloClientTest method testNOParamSOAPMessage.

public void testNOParamSOAPMessage() throws Exception {
    Dispatch dispatch = getDispatchSOAPMessage();
    byte[] bytes = helloSM.getBytes();
    Source source = makeStreamSource(helloSM);
    SOAPMessage message = getSOAPMessage(source);
    try {
        Object result = dispatch.invoke(null);
        assertTrue(result == null);
    } catch (Exception e) {
        assertTrue(e instanceof WebServiceException);
        System.out.println("Exception message " + e.getMessage());
    }
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException) Dispatch(jakarta.xml.ws.Dispatch) SOAPMessage(jakarta.xml.soap.SOAPMessage) Source(javax.xml.transform.Source) MalformedURLException(java.net.MalformedURLException) WebServiceException(jakarta.xml.ws.WebServiceException) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException)

Example 29 with Dispatch

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

the class DispatchHelloClientTest method testNoParamHelloRequestResponseJAXBNegative.

// should send empty SOAPBody here - no argument returned or perhaps server side exception
// nillable allowed message
public void testNoParamHelloRequestResponseJAXBNegative() throws Throwable {
    JAXBContext jc = null;
    HelloRequest hello = null;
    HelloResponse helloResult = null;
    try {
        jc = createJAXBContext();
    } catch (Exception jbe) {
        fail("Problem creating jaxb context");
    }
    try {
        // no hello args
        Dispatch dispatch = getDispatchJAXB();
        Object result = dispatch.invoke(null);
        assertTrue(result == null);
    } catch (Exception e) {
        assertTrue(e instanceof SOAPFaultException);
        System.out.println("NoParamHelloRequestResponseJAXBNegative PASSED");
    }
}
Also used : HelloResponse(client.dispatch.null_jaxb.client.HelloResponse) HelloRequest(client.dispatch.null_jaxb.client.HelloRequest) Dispatch(jakarta.xml.ws.Dispatch) JAXBContext(jakarta.xml.bind.JAXBContext) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException) MalformedURLException(java.net.MalformedURLException) WebServiceException(jakarta.xml.ws.WebServiceException) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException)

Example 30 with Dispatch

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

the class DispatchHelloLiteralTest method testHelloRequestResponseSOAPMessage.

public void testHelloRequestResponseSOAPMessage() throws Exception {
    Dispatch dispatch = getDispatchSOAPMessage();
    byte[] bytes = helloSM.getBytes();
    ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
    Source source = makeStreamSource(helloSM);
    SOAPMessage message = getSOAPMessage12(source);
    Object result = dispatch.invoke(message);
    assertTrue(result instanceof SOAPMessage);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) Dispatch(jakarta.xml.ws.Dispatch) SOAPMessage(jakarta.xml.soap.SOAPMessage) DOMSource(javax.xml.transform.dom.DOMSource) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source) InputSource(org.xml.sax.InputSource) SAXSource(javax.xml.transform.sax.SAXSource)

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