Search in sources :

Example 36 with ProtocolException

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

the class HelloLiteralTest method testMustUnderstand1.

/*
     * MU test here for soap 1.1. Test uses a simple handler
     * on client side to test service with no handlers.
     */
public void testMustUnderstand1() throws Exception {
    String next_1_1 = "http://schemas.xmlsoap.org/soap/actor/next";
    try {
        // clear handlers (should be none) and add helper handler
        ClientServerTestUtil.clearHandlers((BindingProvider) stub);
        MUHelperHandler handler = new MUHelperHandler();
        ClientServerTestUtil.addHandlerToBinding(handler, (BindingProvider) stub);
        // have handler set header that is ignored
        handler.setMUHeader(new QName("urn:mutest", "someheader"), "notarealactor");
        // make the call
        String arg = "foo";
        Hello_Type req = new Hello_Type();
        req.setArgument(arg);
        HelloResponse response = stub.hello(req);
        assertEquals(arg, response.getArgument());
        // add header that should result in soap fault
        handler.setMUHeader(new QName("urn:mutest", "someheader"), next_1_1);
        // make the call
        try {
            response = stub.hello(req);
            fail("did not receive any exception");
        } catch (ProtocolException e) {
            if (e instanceof SOAPFaultException) {
            // pass
            } else {
                fail("did not receive soap fault, received: " + e.toString());
            }
        } catch (Exception e) {
            fail("did not receive protocol exception. received " + e.toString());
        }
    } finally {
        // always clear the handlers
        ClientServerTestUtil.clearHandlers((BindingProvider) stub);
    }
}
Also used : ProtocolException(jakarta.xml.ws.ProtocolException) QName(javax.xml.namespace.QName) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException) MUHelperHandler(fromwsdl.wsdl_hello_lit.client.handlers.MUHelperHandler) ProtocolException(jakarta.xml.ws.ProtocolException) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException)

Aggregations

ProtocolException (jakarta.xml.ws.ProtocolException)36 WebServiceException (jakarta.xml.ws.WebServiceException)14 SOAPFaultException (jakarta.xml.ws.soap.SOAPFaultException)13 HandlerTracker (fromwsdl.handler.common.HandlerTracker)11 HandlerTracker (handler.handler_processing.common.HandlerTracker)11 TestProtocolException (fromwsdl.handler.common.TestProtocolException)5 TestProtocolException (handler.handler_processing.common.TestProtocolException)5 QName (javax.xml.namespace.QName)4 Message (com.sun.xml.ws.api.message.Message)2 MUHelperHandler (fromwsdl.soap12.fault.client.handlers.MUHelperHandler)2 SOAPBody (jakarta.xml.soap.SOAPBody)2 SOAPElement (jakarta.xml.soap.SOAPElement)2 SOAPException (jakarta.xml.soap.SOAPException)2 SOAPMessage (jakarta.xml.soap.SOAPMessage)2 Node (org.w3c.dom.Node)2 SerializationException (com.sun.xml.ws.encoding.soap.SerializationException)1 JAXBMessage (com.sun.xml.ws.message.jaxb.JAXBMessage)1 CheckedExceptionImpl (com.sun.xml.ws.model.CheckedExceptionImpl)1 DispatchException (com.sun.xml.ws.wsdl.DispatchException)1 ExceptionThrowingHandler (fromwsdl.soap12.fault.client.handlers.ExceptionThrowingHandler)1