Search in sources :

Example 1 with HttpComponentsMessageSender

use of org.springframework.ws.transport.http.HttpComponentsMessageSender in project camel by apache.

the class SpringWebserviceProducer method prepareMessageSenders.

private void prepareMessageSenders(SpringWebserviceConfiguration configuration) {
    // Skip this whole thing if none of the relevant config options are set.
    if (!(configuration.getTimeout() > -1) && configuration.getSslContextParameters() == null) {
        return;
    }
    WebServiceTemplate webServiceTemplate = configuration.getWebServiceTemplate();
    WebServiceMessageSender[] messageSenders = webServiceTemplate.getMessageSenders();
    for (int i = 0; i < messageSenders.length; i++) {
        WebServiceMessageSender messageSender = messageSenders[i];
        if (messageSender instanceof HttpComponentsMessageSender) {
            if (configuration.getSslContextParameters() != null) {
                LOG.warn("Not applying SSLContextParameters based configuration to HttpComponentsMessageSender.  " + "If you are using this MessageSender, which you are not by default, you will need " + "to configure SSL using the Commons HTTP 3.x Protocol registry.");
            }
            if (configuration.getTimeout() > -1) {
                if (messageSender.getClass().equals(HttpComponentsMessageSender.class)) {
                    ((HttpComponentsMessageSender) messageSender).setReadTimeout(configuration.getTimeout());
                } else {
                    LOG.warn("Not applying timeout configuration to HttpComponentsMessageSender based implementation.  " + "You are using what appears to be a custom MessageSender, which you are not doing by default. " + "You will need configure timeout on your own.");
                }
            }
        } else if (messageSender.getClass().equals(HttpUrlConnectionMessageSender.class)) {
            // Only if exact match denoting likely use of default configuration.  We don't want to get
            // sub-classes that might have been otherwise injected.
            messageSenders[i] = new AbstractHttpWebServiceMessageSenderDecorator((HttpUrlConnectionMessageSender) messageSender, configuration, getEndpoint().getCamelContext());
        } else {
            // For example this will be the case during unit-testing with the net.javacrumbs.spring-ws-test API
            LOG.warn("Ignoring the timeout and SSLContextParameters options for {}.  You will need to configure " + "these options directly on your custom configured WebServiceMessageSender", messageSender);
        }
    }
}
Also used : AbstractHttpWebServiceMessageSender(org.springframework.ws.transport.http.AbstractHttpWebServiceMessageSender) WebServiceMessageSender(org.springframework.ws.transport.WebServiceMessageSender) HttpComponentsMessageSender(org.springframework.ws.transport.http.HttpComponentsMessageSender) WebServiceTemplate(org.springframework.ws.client.core.WebServiceTemplate) HttpUrlConnectionMessageSender(org.springframework.ws.transport.http.HttpUrlConnectionMessageSender) Endpoint(org.apache.camel.Endpoint)

Aggregations

Endpoint (org.apache.camel.Endpoint)1 WebServiceTemplate (org.springframework.ws.client.core.WebServiceTemplate)1 WebServiceMessageSender (org.springframework.ws.transport.WebServiceMessageSender)1 AbstractHttpWebServiceMessageSender (org.springframework.ws.transport.http.AbstractHttpWebServiceMessageSender)1 HttpComponentsMessageSender (org.springframework.ws.transport.http.HttpComponentsMessageSender)1 HttpUrlConnectionMessageSender (org.springframework.ws.transport.http.HttpUrlConnectionMessageSender)1