Search in sources :

Example 1 with BusException

use of org.apache.cxf.BusException in project OpenAM by OpenRock.

the class SoapSTSConsumer method handleSTSServerCertCNDNSMismatch.

/**
     * This method must be called in case the CN in the Certificate presented by the container hosting the published sts
     * instance does not match the DNS name of this server. This check should not be relied-upon in production, and is
     * only present to facilitate testing.
     * @param stsClient The stsClient which will make the sts invocations
     */
private void handleSTSServerCertCNDNSMismatch(STSClient stsClient) throws SoapSTSConsumerException {
    javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() {

        public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
            return true;
        }
    });
    /*
        CXF client also needs to have disabled the CN check in server-presented cert for TLS cases, if cert CN
        does not match DNS
         */
    TLSClientParameters tlsClientParameters = new TLSClientParameters();
    tlsClientParameters.setDisableCNCheck(true);
    try {
        ((HTTPConduit) stsClient.getClient().getConduit()).setTlsClientParameters(tlsClientParameters);
    } catch (BusException | EndpointException e) {
        throw new SoapSTSConsumerException(e.getMessage(), e);
    }
}
Also used : HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) TLSClientParameters(org.apache.cxf.configuration.jsse.TLSClientParameters) EndpointException(org.apache.cxf.endpoint.EndpointException) BusException(org.apache.cxf.BusException)

Example 2 with BusException

use of org.apache.cxf.BusException in project camel by apache.

the class CamelTransportFactory method unregisterFactory.

public final void unregisterFactory() {
    if (null == bus) {
        return;
    }
    DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
    if (null != dfm && getTransportIds() != null) {
        for (String ns : getTransportIds()) {
            try {
                if (dfm.getDestinationFactory(ns) == this) {
                    dfm.deregisterDestinationFactory(ns);
                }
            } catch (BusException e) {
            //ignore
            }
        }
    }
    ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
    if (cim != null && getTransportIds() != null) {
        for (String ns : getTransportIds()) {
            try {
                if (cim.getConduitInitiator(ns) == this) {
                    cim.deregisterConduitInitiator(ns);
                }
            } catch (BusException e) {
            //ignore
            }
        }
    }
}
Also used : DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) ConduitInitiatorManager(org.apache.cxf.transport.ConduitInitiatorManager) BusException(org.apache.cxf.BusException)

Example 3 with BusException

use of org.apache.cxf.BusException in project cxf by apache.

the class SpringBusFactoryTest method checkTransportFactories.

private void checkTransportFactories(Bus bus) throws BusException {
    DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
    assertNotNull("No destination factory manager", dfm);
    ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
    assertNotNull("No conduit initiator manager", cim);
    try {
        cim.getConduitInitiator("http://cxf.apache.org/unknown");
    } catch (BusException ex) {
    // expected
    }
    try {
        dfm.getDestinationFactory("http://cxf.apache.org/unknown");
    } catch (BusException ex) {
    // expected
    }
    // not sure that we need this - Dan Diephouse
    // assertNotNull("conduit initiator not available",
    // cim.getConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/"));
    assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://cxf.apache.org/transports/http"));
    assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://cxf.apache.org/transports/jms"));
    assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://cxf.apache.org/transports/jms/configuration"));
    assertNotNull("destination factory not available", dfm.getDestinationFactory("http://cxf.apache.org/transports/http"));
    assertNotNull("destination factory not available", dfm.getDestinationFactory("http://cxf.apache.org/transports/jms"));
    assertNotNull("destination factory not available", dfm.getDestinationFactory("http://cxf.apache.org/transports/jms/configuration"));
}
Also used : DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) ConduitInitiatorManager(org.apache.cxf.transport.ConduitInitiatorManager) BusException(org.apache.cxf.BusException)

Example 4 with BusException

use of org.apache.cxf.BusException in project cxf by apache.

the class SpringBusFactoryTest method checkBindingExtensions.

private void checkBindingExtensions(Bus bus) throws BusException {
    BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);
    assertNotNull("No binding factory manager", bfm);
    assertNotNull("binding factory not available", bfm.getBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/"));
    try {
        bfm.getBindingFactory("http://cxf.apache.org/unknown");
    } catch (BusException ex) {
    // expected
    }
}
Also used : BindingFactoryManager(org.apache.cxf.binding.BindingFactoryManager) BusException(org.apache.cxf.BusException)

Example 5 with BusException

use of org.apache.cxf.BusException in project cxf by apache.

the class AbstractConduitSelector method getSelectedConduit.

/**
 * Mechanics to actually get the Conduit from the ConduitInitiator
 * if necessary.
 *
 * @param message the current Message
 */
protected Conduit getSelectedConduit(Message message) {
    Conduit c = findCompatibleConduit(message);
    if (c == null) {
        Exchange exchange = message.getExchange();
        EndpointInfo ei = endpoint.getEndpointInfo();
        String transportID = ei.getTransportId();
        try {
            ConduitInitiatorManager conduitInitiatorMgr = exchange.getBus().getExtension(ConduitInitiatorManager.class);
            if (conduitInitiatorMgr != null) {
                ConduitInitiator conduitInitiator = conduitInitiatorMgr.getConduitInitiator(transportID);
                if (conduitInitiator != null) {
                    c = createConduit(message, exchange, conduitInitiator);
                } else {
                    getLogger().warning("ConduitInitiator not found: " + ei.getAddress());
                }
            } else {
                getLogger().warning("ConduitInitiatorManager not found");
            }
        } catch (BusException ex) {
            throw new Fault(ex);
        } catch (IOException ex) {
            throw new Fault(ex);
        }
    }
    if (c != null && c.getTarget() != null && c.getTarget().getAddress() != null) {
        replaceEndpointAddressPropertyIfNeeded(message, c.getTarget().getAddress().getValue(), c);
    }
    // the search for the conduit could cause extra properties to be reset/loaded.
    message.resetContextCache();
    message.put(Conduit.class, c);
    return c;
}
Also used : Exchange(org.apache.cxf.message.Exchange) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Conduit(org.apache.cxf.transport.Conduit) ConduitInitiatorManager(org.apache.cxf.transport.ConduitInitiatorManager) ConduitInitiator(org.apache.cxf.transport.ConduitInitiator) Fault(org.apache.cxf.interceptor.Fault) IOException(java.io.IOException) BusException(org.apache.cxf.BusException)

Aggregations

BusException (org.apache.cxf.BusException)28 DestinationFactoryManager (org.apache.cxf.transport.DestinationFactoryManager)7 Test (org.junit.Test)7 IOException (java.io.IOException)6 BindingFactoryManager (org.apache.cxf.binding.BindingFactoryManager)6 EndpointException (org.apache.cxf.endpoint.EndpointException)6 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)6 JaxWsServiceFactoryBean (org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean)5 BindingInfo (org.apache.cxf.service.model.BindingInfo)5 Bus (org.apache.cxf.Bus)4 Message (org.apache.cxf.common.i18n.Message)4 ServiceConstructionException (org.apache.cxf.service.factory.ServiceConstructionException)4 BeanInvoker (org.apache.cxf.service.invoker.BeanInvoker)4 ConduitInitiatorManager (org.apache.cxf.transport.ConduitInitiatorManager)4 DestinationFactory (org.apache.cxf.transport.DestinationFactory)4 WebServiceContext (javax.xml.ws.WebServiceContext)3 BindingFactory (org.apache.cxf.binding.BindingFactory)3 ClassLoaderHolder (org.apache.cxf.common.classloader.ClassLoaderUtils.ClassLoaderHolder)3 Endpoint (org.apache.cxf.endpoint.Endpoint)3 GreeterImpl (org.apache.hello_world_soap_http.GreeterImpl)3