Search in sources :

Example 6 with HandlerResolver

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

the class HandlerClient method testDynamic2.

/*
     * Test tries to add a handler programmatically after clearing
     * handlers out of the service. Adds handler using HandlerResolver.
     * Uses a null HandlerResolver to clear the service.
     */
public void testDynamic2() throws Exception {
    Hello_Service service = createService();
    service.setHandlerResolver(null);
    Hello stub = createStub(service);
    int x = 1;
    // 2 per handler invoked
    int diff = 2;
    int y = stub.hello(x);
    assertEquals(x + diff, y);
    // now add client handler
    service.setHandlerResolver(new HandlerResolver() {

        public List<Handler> getHandlerChain(PortInfo info) {
            List list = new ArrayList<Handler>();
            list.add(new SOAPTestHandler());
            return list;
        }
    });
    stub = createStub(service);
    // test again
    diff = 4;
    y = stub.hello(x);
    assertTrue(y == x + diff);
}
Also used : PortInfo(jakarta.xml.ws.handler.PortInfo) HandlerResolver(jakarta.xml.ws.handler.HandlerResolver) SOAPTestHandler(fromwsdl.handler_simple_rpclit.common.SOAPTestHandler) Handler(jakarta.xml.ws.handler.Handler) SOAPTestHandler(fromwsdl.handler_simple_rpclit.common.SOAPTestHandler) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

Handler (jakarta.xml.ws.handler.Handler)6 HandlerResolver (jakarta.xml.ws.handler.HandlerResolver)6 PortInfo (jakarta.xml.ws.handler.PortInfo)6 ArrayList (java.util.ArrayList)6 List (java.util.List)6 SOAPTestHandler (fromwsdl.handler_simple.common.SOAPTestHandler)2 SOAPTestHandler (fromwsdl.handler_simple_rpclit.common.SOAPTestHandler)2 Binding (jakarta.xml.ws.Binding)2 BindingProvider (jakarta.xml.ws.BindingProvider)2 TestHandler (fromjava.handler_simple.common.TestHandler)1 TestHandler (fromwsdl.handler_dd.common.TestHandler)1