如何在Spring WS 2.14中使用httpClient到4.3?

时间:2014-04-24 18:46:00

标签: httpclient spring-ws

使用Httpclient 3,我的Spring bean定义是

<bean id="messageSender"
class="org.springframework.ws.transport.http.CommonsHttpMessageSender">
<constructor-arg>
    <bean class="org.apache.commons.httpclient.HttpClient">
        <constructor-arg>
            <bean
                class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager">
                <property name="params">
                    <bean
                        class="org.apache.commons.httpclient.params.HttpConnectionManagerParams">
                        <property name="defaultMaxConnectionsPerHost" value="XX" />
                        <property name="maxTotalConnections" value="XX" />
                        <property name="staleCheckingEnabled" value="false" />
                        <property name="tcpNoDelay" value="false" />
                        <property name="soTimeout" value="XXXXX" />
                        <property name="connectionTimeout"
                            value="XXXX" />
                    </bean>
                </property>
            </bean>
        </constructor-arg>
    </bean>
</constructor-arg>

我想要一个与httpclient 4.3类相似的bean配置。

1 个答案:

答案 0 :(得分:1)

我需要在我的连接上进行NTLMv2身份验证,并且通过使用附加到此问题的类配置spring,我能够成功使用4.x:https://jira.spring.io/browse/SWS-563

这是@Configuration的一部分:

@Bean public WebServiceTemplate webserviceTemplate() {
    WebServiceTemplate webserviceTemplate = new WebServiceTemplate();
    webserviceTemplate.setMessageSender(messageSender());

    return webserviceTemplate;
}

@Bean public WebServiceMessageSender messageSender() {
    HttpClientMessageSender messageSender = new HttpClientMessageSender();

    // do 4.x specific configuration

    return messageSender;
}