Search in sources :

Example 1 with SOAPTestHandler

use of fromwsdl.handler_simple_rpclit.common.SOAPTestHandler in project metro-jax-ws by eclipse-ee4j.

the class HandlerClient method testDynamic1.

/*
     * Test tries to add a handler programmatically after clearing
     * handlers out of the service. Adds handler to binding. Uses
     * an empty handler resolver for clearing the service.
     */
public void testDynamic1() throws Exception {
    Hello_Service service = createService();
    service.setHandlerResolver(new HandlerResolver() {

        public List<Handler> getHandlerChain(PortInfo info) {
            return new ArrayList<Handler>();
        }
    });
    Hello stub = createStub(service);
    int x = 1;
    // 2 per handler invoked
    int diff = 2;
    int y = stub.hello(x);
    assertTrue(y == x + diff);
    // now add client handler
    List<Handler> handlerList = new ArrayList<Handler>();
    handlerList.add(new SOAPTestHandler());
    Binding binding = ((BindingProvider) stub).getBinding();
    binding.setHandlerChain(handlerList);
    // test again
    diff = 4;
    y = stub.hello(x);
    assertTrue(y == x + diff);
}
Also used : Binding(jakarta.xml.ws.Binding) SOAPTestHandler(fromwsdl.handler_simple_rpclit.common.SOAPTestHandler) ArrayList(java.util.ArrayList) Handler(jakarta.xml.ws.handler.Handler) SOAPTestHandler(fromwsdl.handler_simple_rpclit.common.SOAPTestHandler) BindingProvider(jakarta.xml.ws.BindingProvider) PortInfo(jakarta.xml.ws.handler.PortInfo) HandlerResolver(jakarta.xml.ws.handler.HandlerResolver) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with SOAPTestHandler

use of fromwsdl.handler_simple_rpclit.common.SOAPTestHandler 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

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