Search in sources :

Example 51 with Handler

use of javax.xml.ws.handler.Handler in project cxf by apache.

the class AnnotationHandlerChainBuilderTest method testFindHandlerChainAnnotationPerPortServiceBinding.

@Test
public void testFindHandlerChainAnnotationPerPortServiceBinding() {
    HandlerTestImpl handlerTestImpl = new HandlerTestImpl();
    AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
    QName portQName = new QName("namespacedoesntsupportyet", "SoapPort1");
    QName serviceQName = new QName("namespacedoesntsupportyet", "SoapService1");
    String bindingID = "http://schemas.xmlsoap.org/wsdl/soap/http";
    @SuppressWarnings("rawtypes") List<Handler> handlers = chainBuilder.buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName, bindingID);
    assertNotNull(handlers);
    assertEquals(5, handlers.size());
}
Also used : QName(javax.xml.namespace.QName) Handler(javax.xml.ws.handler.Handler) LogicalHandler(javax.xml.ws.handler.LogicalHandler) Test(org.junit.Test)

Example 52 with Handler

use of javax.xml.ws.handler.Handler in project OpenOLAT by OpenOLAT.

the class ViteroManager method checkConnection.

public boolean checkConnection(final String url, final String login, final String password, final int customerId) throws VmsNotAvailableException {
    try {
        LicenceService ss = new LicenceService();
        ss.setHandlerResolver(new HandlerResolver() {

            @SuppressWarnings("rawtypes")
            @Override
            public List<Handler> getHandlerChain(PortInfo portInfo) {
                List<Handler> handlerList = new ArrayList<Handler>();
                handlerList.add(new ViteroSecurityHandler(login, password));
                return handlerList;
            }
        });
        Licence port = ss.getLicenceSoap11();
        String endPoint = UriBuilder.fromUri(url).path("services").path("LicenseService").build().toString();
        ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);
        GetModulesForCustomerRequest request = new GetModulesForCustomerRequest();
        request.setCustomerid(customerId);
        Modulestype modulesType = port.getModulesForCustomer(request);
        return modulesType != null;
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch(code) {
            case unsufficientRights:
                log.error("Unsufficient rights", f);
                break;
            default:
                logAxisError("Cannot check connection", f);
        }
        return false;
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        log.warn("Error checking connection", e);
        return false;
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) Handler(javax.xml.ws.handler.Handler) ViteroSecurityHandler(de.vitero.ViteroSecurityHandler) DataHandler(javax.activation.DataHandler) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) Modulestype(de.vitero.schema.licence.Modulestype) PortInfo(javax.xml.ws.handler.PortInfo) HandlerResolver(javax.xml.ws.handler.HandlerResolver) GetModulesForCustomerRequest(de.vitero.schema.licence.GetModulesForCustomerRequest) Licence(de.vitero.schema.licence.Licence) ArrayList(java.util.ArrayList) List(java.util.List) ErrorCode(org.olat.modules.vitero.model.ErrorCode) ViteroSecurityHandler(de.vitero.ViteroSecurityHandler) LicenceService(de.vitero.schema.licence.LicenceService) ConnectException(java.net.ConnectException)

Example 53 with Handler

use of javax.xml.ws.handler.Handler in project narayana by jbosstm.

the class ATInteropClient method getParticipantPort.

// don't think we ever need this as we get a registration port from the endpoint ref returned by
// the activation port request
public static ParticipantPortType getParticipantPort(MAP map, String action) {
    ParticipantService service = getParticipantService();
    ParticipantPortType port = service.getPort(ParticipantPortType.class, new AddressingFeature(true, true));
    BindingProvider bindingProvider = (BindingProvider) port;
    String to = map.getTo();
    List<Handler> customHandlerChain = new ArrayList<Handler>();
    /*
         * we need to add the coordination context handler in the case where we are passing a
         * coordination context via a header element
         */
    customHandlerChain.add(new CoordinationContextHandler());
    /*
         * we no longer have to add the JaxWS WSAddressingClientHandler because we can specify the WSAddressing feature
		customHandlerChain.add(new WSAddressingClientHandler());
         */
    bindingProvider.getBinding().setHandlerChain(customHandlerChain);
    Map<String, Object> requestContext = bindingProvider.getRequestContext();
    map.setAction(action);
    map.setFrom(getInitiator());
    AddressingHelper.configureRequestContext(requestContext, map, to, action);
    return port;
}
Also used : ParticipantService(com.jboss.transaction.txinterop.webservices.atinterop.generated.ParticipantService) AddressingFeature(javax.xml.ws.soap.AddressingFeature) ParticipantPortType(com.jboss.transaction.txinterop.webservices.atinterop.generated.ParticipantPortType) CoordinationContextHandler(com.jboss.transaction.txinterop.webservices.handlers.CoordinationContextHandler) ArrayList(java.util.ArrayList) CoordinationContextHandler(com.jboss.transaction.txinterop.webservices.handlers.CoordinationContextHandler) Handler(javax.xml.ws.handler.Handler) BindingProvider(javax.xml.ws.BindingProvider)

Example 54 with Handler

use of javax.xml.ws.handler.Handler in project narayana by jbosstm.

the class BAInteropClient method getParticipantPort.

// don't think we ever need this as we get a registration port from the endpoint ref returned by
// the activation port request
public static ParticipantPortType getParticipantPort(MAP map, String action) {
    ParticipantService service = getParticipantService();
    ParticipantPortType port = service.getPort(ParticipantPortType.class, new AddressingFeature(true, true));
    BindingProvider bindingProvider = (BindingProvider) port;
    String to = map.getTo();
    List<Handler> customHandlerChain = new ArrayList<Handler>();
    /*
         * we no longer have to add the JaxWS WSAddressingClientHandler because we can specify the WSAddressing feature
		customHandlerChain.add(new WSAddressingClientHandler());
         */
    /*
         * we need to add the coordination context handler in the case where we are passing a
         * coordination context via a header element
         */
    customHandlerChain.add(new CoordinationContextHandler());
    bindingProvider.getBinding().setHandlerChain(customHandlerChain);
    Map<String, Object> requestContext = bindingProvider.getRequestContext();
    map.setAction(action);
    AddressingHelper.configureRequestContext(requestContext, map, to, action);
    return port;
}
Also used : ParticipantService(com.jboss.transaction.txinterop.webservices.bainterop.generated.ParticipantService) AddressingFeature(javax.xml.ws.soap.AddressingFeature) ParticipantPortType(com.jboss.transaction.txinterop.webservices.bainterop.generated.ParticipantPortType) CoordinationContextHandler(com.jboss.transaction.txinterop.webservices.handlers.CoordinationContextHandler) ArrayList(java.util.ArrayList) CoordinationContextHandler(com.jboss.transaction.txinterop.webservices.handlers.CoordinationContextHandler) Handler(javax.xml.ws.handler.Handler) BindingProvider(javax.xml.ws.BindingProvider)

Example 55 with Handler

use of javax.xml.ws.handler.Handler in project narayana by jbosstm.

the class TestServiceBAClient method getClientWithManuallyAddedHandler.

public static TestServiceBA getClientWithManuallyAddedHandler() throws MalformedURLException {
    TestServiceBAClient client = new TestServiceBAClient();
    Service service = Service.create(new URL(WSDL_URL), SERVICE_NAME);
    client.testService = service.getPort(PORT_NAME, TestServiceBA.class);
    BindingProvider bindingProvider = (BindingProvider) client.testService;
    @SuppressWarnings("rawtypes") List<Handler> handlers = new ArrayList<Handler>(1);
    handlers.add(new JaxWSHeaderContextProcessor());
    bindingProvider.getBinding().setHandlerChain(handlers);
    return client;
}
Also used : JaxWSHeaderContextProcessor(com.arjuna.mw.wst11.client.JaxWSHeaderContextProcessor) ArrayList(java.util.ArrayList) Service(javax.xml.ws.Service) Handler(javax.xml.ws.handler.Handler) BindingProvider(javax.xml.ws.BindingProvider) URL(java.net.URL)

Aggregations

Handler (javax.xml.ws.handler.Handler)100 QName (javax.xml.namespace.QName)47 ArrayList (java.util.ArrayList)46 BindingProvider (javax.xml.ws.BindingProvider)36 URL (java.net.URL)32 Service (javax.xml.ws.Service)29 Test (org.junit.Test)29 LogicalHandler (javax.xml.ws.handler.LogicalHandler)24 Binding (javax.xml.ws.Binding)11 WebServiceException (javax.xml.ws.WebServiceException)11 MessageContext (javax.xml.ws.handler.MessageContext)9 SOAPHandler (javax.xml.ws.handler.soap.SOAPHandler)9 Exchange (org.apache.cxf.message.Exchange)9 IOException (java.io.IOException)8 SOAPMessageContext (javax.xml.ws.handler.soap.SOAPMessageContext)7 HandlerChainInvoker (org.apache.cxf.jaxws.handler.HandlerChainInvoker)7 DataHandler (javax.activation.DataHandler)6 InitialContext (javax.naming.InitialContext)6 Source (javax.xml.transform.Source)6 DOMSource (javax.xml.transform.dom.DOMSource)6