Search in sources :

Example 11 with LoggingFeature

use of org.apache.cxf.feature.LoggingFeature in project camel by apache.

the class CxfEndpoint method setupClientFactoryBean.

protected void setupClientFactoryBean(ClientFactoryBean factoryBean, Class<?> cls) {
    if (cls != null) {
        factoryBean.setServiceClass(cls);
    }
    factoryBean.setInInterceptors(in);
    factoryBean.setOutInterceptors(out);
    factoryBean.setOutFaultInterceptors(outFault);
    factoryBean.setInFaultInterceptors(inFault);
    factoryBean.setFeatures(features);
    factoryBean.setTransportId(transportId);
    factoryBean.setBindingId(bindingId);
    if (bindingConfig != null) {
        factoryBean.setBindingConfig(bindingConfig);
    }
    if (dataBinding != null) {
        factoryBean.setDataBinding(dataBinding);
    }
    if (serviceFactoryBean != null) {
        setServiceFactory(factoryBean, serviceFactoryBean);
    }
    // address
    factoryBean.setAddress(getAddress());
    // wsdl url
    if (getWsdlURL() != null) {
        factoryBean.setWsdlURL(getWsdlURL());
    }
    // service name qname
    if (getServiceName() != null) {
        factoryBean.setServiceName(getServiceName());
    }
    // port name qname
    if (getPortName() != null) {
        factoryBean.setEndpointName(getPortName());
    }
    // apply feature here
    if (getDataFormat().dealias() == DataFormat.RAW) {
        RAWDataFormatFeature feature = new RAWDataFormatFeature();
        feature.addInIntercepters(getInInterceptors());
        feature.addOutInterceptors(getOutInterceptors());
        factoryBean.getFeatures().add(feature);
    } else if (getDataFormat().dealias() == DataFormat.CXF_MESSAGE) {
        factoryBean.getFeatures().add(new CXFMessageDataFormatFeature());
        factoryBean.setDataBinding(new SourceDataBinding());
    } else if (getDataFormat() == DataFormat.PAYLOAD) {
        factoryBean.getFeatures().add(new PayLoadDataFormatFeature(allowStreaming));
        factoryBean.setDataBinding(new HybridSourceDataBinding());
    }
    if (isLoggingFeatureEnabled()) {
        if (getLoggingSizeLimit() != 0) {
            factoryBean.getFeatures().add(new LoggingFeature(getLoggingSizeLimit()));
        } else {
            factoryBean.getFeatures().add(new LoggingFeature());
        }
    }
    // set the document-literal wrapped style
    if (getWrappedStyle() != null) {
        setWrapped(factoryBean, getWrappedStyle());
    }
    // any optional properties
    if (getProperties() != null) {
        if (factoryBean.getProperties() != null) {
            // add to existing properties
            factoryBean.getProperties().putAll(getProperties());
        } else {
            factoryBean.setProperties(getProperties());
        }
        LOG.debug("ClientFactoryBean: {} added properties: {}", factoryBean, getProperties());
    }
    // setup the basic authentication property
    if (ObjectHelper.isNotEmpty(username)) {
        AuthorizationPolicy authPolicy = new AuthorizationPolicy();
        authPolicy.setUserName(username);
        authPolicy.setPassword(password);
        if (factoryBean.getProperties() == null) {
            factoryBean.setProperties(new HashMap<String, Object>());
        }
        factoryBean.getProperties().put(AuthorizationPolicy.class.getName(), authPolicy);
    }
    if (this.isSkipPayloadMessagePartCheck()) {
        if (factoryBean.getProperties() == null) {
            factoryBean.setProperties(new HashMap<String, Object>());
        }
        factoryBean.getProperties().put("soap.no.validate.parts", Boolean.TRUE);
    }
    if (this.isSkipFaultLogging()) {
        if (factoryBean.getProperties() == null) {
            factoryBean.setProperties(new HashMap<String, Object>());
        }
        factoryBean.getProperties().put(FaultListener.class.getName(), new NullFaultListener());
    }
    factoryBean.setBus(getBus());
    getNullSafeCxfEndpointConfigurer().configure(factoryBean);
}
Also used : AuthorizationPolicy(org.apache.cxf.configuration.security.AuthorizationPolicy) RAWDataFormatFeature(org.apache.camel.component.cxf.feature.RAWDataFormatFeature) LoggingFeature(org.apache.cxf.feature.LoggingFeature) PayLoadDataFormatFeature(org.apache.camel.component.cxf.feature.PayLoadDataFormatFeature) FaultListener(org.apache.cxf.logging.FaultListener) CXFMessageDataFormatFeature(org.apache.camel.component.cxf.feature.CXFMessageDataFormatFeature) SourceDataBinding(org.apache.cxf.databinding.source.SourceDataBinding)

Aggregations

LoggingFeature (org.apache.cxf.feature.LoggingFeature)11 CXFMessageDataFormatFeature (org.apache.camel.component.cxf.feature.CXFMessageDataFormatFeature)2 PayLoadDataFormatFeature (org.apache.camel.component.cxf.feature.PayLoadDataFormatFeature)2 RAWDataFormatFeature (org.apache.camel.component.cxf.feature.RAWDataFormatFeature)2 SourceDataBinding (org.apache.cxf.databinding.source.SourceDataBinding)2 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)2 FaultListener (org.apache.cxf.logging.FaultListener)2 WebServiceProvider (javax.xml.ws.WebServiceProvider)1 AuthorizationPolicy (org.apache.cxf.configuration.security.AuthorizationPolicy)1 JAXRSServerFactoryBean (org.apache.cxf.jaxrs.JAXRSServerFactoryBean)1