Search in sources :

Example 6 with PortInfo

use of jakarta.xml.ws.handler.PortInfo 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)

Example 7 with PortInfo

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

the class HandlerChainTester method testPortInfoImpl.

/*
    Commenting this test as this no longer is useful.
    In 2.1, When we try to add a invalid Port to a service with wsdl, now we throw WebServiceException,
    during addPort() itself saying Port name is not a valid port in the wsdl.

    public void testHandlersOnUnknownPortDispatch(){
        TestService_Service service = getService();
        String bindingId = SOAPBinding.SOAP11HTTP_BINDING;
        service.addPort(UNKNOWNPORT, bindingId, endpointAddress);
        Dispatch<Source> dispatch = service.createDispatch(UNKNOWNPORT, Source.class,Service.Mode.PAYLOAD);
        Binding testBinding = ((BindingProvider) dispatch).getBinding();
        List<Handler> chain = testBinding.getHandlerChain();
        //System.out.println(chain.size());
        assertEquals(2,chain.size());
    }
    */
public void testPortInfoImpl() {
    PortInfo portInfo = new PortInfoImpl(BindingID.SOAP11_HTTP, new QName("http://example.com/", "EchoPort"), new QName("http://example.com/", "EchoService"));
    assertTrue(portInfo.equals(portInfo));
}
Also used : PortInfo(jakarta.xml.ws.handler.PortInfo) QName(javax.xml.namespace.QName) PortInfoImpl(com.sun.xml.ws.handler.PortInfoImpl)

Aggregations

PortInfo (jakarta.xml.ws.handler.PortInfo)7 Handler (jakarta.xml.ws.handler.Handler)6 HandlerResolver (jakarta.xml.ws.handler.HandlerResolver)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 PortInfoImpl (com.sun.xml.ws.handler.PortInfoImpl)1 TestHandler (fromjava.handler_simple.common.TestHandler)1 TestHandler (fromwsdl.handler_dd.common.TestHandler)1 QName (javax.xml.namespace.QName)1