Search in sources :

Example 21 with Handler

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

the class HandlerChainTester method testHandlersOnReportPort3.

public void testHandlersOnReportPort3() {
    Service service = Service.create(WSDL_LOCATION, TESTSERVICE);
    ReportService testStub = service.getPort(REPORTSERVICEPORT, ReportService.class);
    Binding testBinding = ((BindingProvider) testStub).getBinding();
    List<Handler> chain = testBinding.getHandlerChain();
    // System.out.println(chain.size());
    assertEquals(0, chain.size());
}
Also used : SOAPBinding(jakarta.xml.ws.soap.SOAPBinding) Binding(jakarta.xml.ws.Binding) Service(jakarta.xml.ws.Service) Handler(jakarta.xml.ws.handler.Handler) BindingProvider(jakarta.xml.ws.BindingProvider)

Example 22 with Handler

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

the class HandlerChainTester method testHandlersOnTestPort1.

public void testHandlersOnTestPort1() {
    Service service = Service.create(WSDL_LOCATION, TESTSERVICE);
    TestService testStub = service.getPort(TestService.class);
    Binding testBinding = ((BindingProvider) testStub).getBinding();
    List<Handler> chain = testBinding.getHandlerChain();
    // System.out.println(chain.size());
    assertEquals(0, chain.size());
}
Also used : SOAPBinding(jakarta.xml.ws.soap.SOAPBinding) Binding(jakarta.xml.ws.Binding) Service(jakarta.xml.ws.Service) Handler(jakarta.xml.ws.handler.Handler) BindingProvider(jakarta.xml.ws.BindingProvider)

Example 23 with Handler

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

the class HandlerChainTester method testHandlersOnReportPort.

public void testHandlersOnReportPort() {
    TestService_Service service = getService();
    ReportService testStub = service.getReportServicePort();
    Binding testBinding = ((BindingProvider) testStub).getBinding();
    List<Handler> chain = testBinding.getHandlerChain();
    // System.out.println(chain.size());
    assertEquals(2, chain.size());
}
Also used : SOAPBinding(jakarta.xml.ws.soap.SOAPBinding) Binding(jakarta.xml.ws.Binding) Handler(jakarta.xml.ws.handler.Handler) BindingProvider(jakarta.xml.ws.BindingProvider)

Example 24 with Handler

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

the class WSEndpointImpl method dispose.

@Override
public synchronized void dispose() {
    if (disposed) {
        return;
    }
    disposed = true;
    masterTubeline.preDestroy();
    for (Handler handler : binding.getHandlerChain()) {
        for (Method method : handler.getClass().getMethods()) {
            if (method.getAnnotation(PreDestroy.class) == null) {
                continue;
            }
            try {
                method.invoke(handler);
            } catch (Exception e) {
                logger.log(Level.WARNING, HandlerMessages.HANDLER_PREDESTROY_IGNORE(e.getMessage()), e);
            }
            break;
        }
    }
    closeManagedObjectManager();
    LazyMOMProvider.INSTANCE.unregisterEndpoint(this);
}
Also used : PreDestroy(jakarta.annotation.PreDestroy) Handler(jakarta.xml.ws.handler.Handler) Method(java.lang.reflect.Method) XMLStreamException(javax.xml.stream.XMLStreamException) WebServiceException(jakarta.xml.ws.WebServiceException)

Example 25 with Handler

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

the class BindingTester method testBinding1.

/*
     * test the binding objects for the right number of handlers
     */
public void testBinding1() throws Exception {
    TestService_Service service = getService();
    TestService testStub = getTestStub(service);
    ReportService reportStub = getReportStub(service);
    // get the bindings
    Binding testBinding = ((BindingProvider) testStub).getBinding();
    Binding reportBinding = ((BindingProvider) reportStub).getBinding();
    assertNotNull("Binding object should not be null", testBinding);
    assertNotNull("Binding object should not be null", reportBinding);
    // check the handlers
    List<Handler> testHandlers = testBinding.getHandlerChain();
    List<Handler> reportHandlers = reportBinding.getHandlerChain();
    assertNotNull("Handler list should not be null", testHandlers);
    assertNotNull("Handler list should not be null", reportHandlers);
    // check number of handlers
    assertEquals("got wrong number of handlers in test binding", SERVICE_HANDLERS + TEST_PORT_HANDLERS + PROTOCOL_HANDLERS, testHandlers.size());
    assertEquals("got wrong number of handlers in report binding", SERVICE_HANDLERS + REPORT_PORT_HANDLERS + PROTOCOL_HANDLERS, reportHandlers.size());
    // check handler names -- see config file for order
    int[] testNames = { 4, 0, 5, 1, 7, 3 };
    int[] reportNames = { 4, 0, 2, 6, 7, 3 };
    String foundName = null;
    for (int i = 0; i < testNames.length; i++) {
        foundName = ((HasName) testHandlers.get(i)).getName();
        assertEquals("found unexpected handler in chain", CLIENT_PREFIX + testNames[i], foundName);
    }
    for (int i = 0; i < reportNames.length; i++) {
        foundName = ((HasName) reportHandlers.get(i)).getName();
        assertEquals("found unexpected handler in chain", CLIENT_PREFIX + reportNames[i], foundName);
    }
}
Also used : SOAPBinding(jakarta.xml.ws.soap.SOAPBinding) Binding(jakarta.xml.ws.Binding) BaseSOAPHandler(fromwsdl.handler.common.BaseSOAPHandler) Handler(jakarta.xml.ws.handler.Handler) BindingProvider(jakarta.xml.ws.BindingProvider)

Aggregations

Handler (jakarta.xml.ws.handler.Handler)43 Binding (jakarta.xml.ws.Binding)30 BindingProvider (jakarta.xml.ws.BindingProvider)28 ArrayList (java.util.ArrayList)18 SOAPBinding (jakarta.xml.ws.soap.SOAPBinding)15 SOAPTestHandler (fromwsdl.handler_simple.common.SOAPTestHandler)7 Service (jakarta.xml.ws.Service)7 List (java.util.List)7 HandlerResolver (jakarta.xml.ws.handler.HandlerResolver)6 PortInfo (jakarta.xml.ws.handler.PortInfo)6 SOAPTestHandler (fromwsdl.handler_simple_rpclit.common.SOAPTestHandler)5 BaseSOAPHandler (fromwsdl.handler.common.BaseSOAPHandler)4 WebServiceException (jakarta.xml.ws.WebServiceException)4 Source (javax.xml.transform.Source)4 HandlerTracker (fromwsdl.handler.common.HandlerTracker)3 SOAPFaultException (jakarta.xml.ws.soap.SOAPFaultException)3 HandlerAnnotationInfo (com.sun.xml.ws.util.HandlerAnnotationInfo)2 BaseSOAPHandler (handler.handler_processing.common.BaseSOAPHandler)2 SOAPMessage (jakarta.xml.soap.SOAPMessage)2 AsyncHandler (jakarta.xml.ws.AsyncHandler)2