SOAP: custom connection and read time out for client SOAP connections
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 21 Feb 2016 16:48:17 +0000 (17:48 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 21 Feb 2016 16:48:17 +0000 (17:48 +0100)
SOAP/cxf/web-services-spring-cxf-client/src/main/java/de/spring/webservices/client/transport/http/CustomHttpRequestMessageSender.java
SOAP/cxf/web-services-spring-cxf-client/src/main/resources/spring-configuration/ws/client-spring-configuration.xml
SOAP/jaxb2/web-services-spring-jaxb2-client/src/main/java/de/spring/webservices/client/transport/http/CustomHttpRequestMessageSender.java
SOAP/jaxb2/web-services-spring-jaxb2-client/src/main/resources/spring-configuration/ws/client-spring-configuration.xml

index cf44220..3e63544 100644 (file)
@@ -40,6 +40,10 @@ public class CustomHttpRequestMessageSender extends AbstractHttpWebServiceMessag
        public CustomHttpRequestMessageSender() {
                requestFactory = new SimpleClientHttpRequestFactory();
        }
+       
+       public CustomHttpRequestMessageSender(ClientHttpRequestFactory requestFactory) {
+               this.requestFactory = requestFactory;
+       }
 
        @Override
        public WebServiceConnection createConnection(URI uri) throws IOException {
index 7f6f1f3..cb926e7 100644 (file)
@@ -6,6 +6,7 @@
     xmlns:oxm="http://www.springframework.org/schema/oxm" 
     xmlns:aop="http://www.springframework.org/schema/aop"
     xmlns:util="http://www.springframework.org/schema/util"
+    xmlns:p="http://www.springframework.org/schema/p"
 
     xsi:schemaLocation="http://www.springframework.org/schema/beans 
         http://www.springframework.org/schema/beans/spring-beans.xsd
         
         <property name="messageSenders">
                <list>
-                       <bean class="de.spring.webservices.client.transport.http.CustomHttpRequestMessageSender" />
+                <bean class="de.spring.webservices.client.transport.http.CustomHttpRequestMessageSender">
+                       <constructor-arg>
+                               <bean class="org.springframework.http.client.SimpleClientHttpRequestFactory"
+                                       p:readTimeout="2000"
+                                       p:connectTimeout="1000" />
+                       </constructor-arg>
+                </bean>
                </list>
         </property>
     </bean>
index cf44220..3e63544 100644 (file)
@@ -40,6 +40,10 @@ public class CustomHttpRequestMessageSender extends AbstractHttpWebServiceMessag
        public CustomHttpRequestMessageSender() {
                requestFactory = new SimpleClientHttpRequestFactory();
        }
+       
+       public CustomHttpRequestMessageSender(ClientHttpRequestFactory requestFactory) {
+               this.requestFactory = requestFactory;
+       }
 
        @Override
        public WebServiceConnection createConnection(URI uri) throws IOException {
index 9358079..ff12bd2 100644 (file)
@@ -6,7 +6,8 @@
     xmlns:oxm="http://www.springframework.org/schema/oxm" 
     xmlns:aop="http://www.springframework.org/schema/aop"
     xmlns:util="http://www.springframework.org/schema/util"
-
+       xmlns:p="http://www.springframework.org/schema/p"
+       
     xsi:schemaLocation="http://www.springframework.org/schema/beans 
         http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/context 
 
         <property name="messageSenders">
             <list>
-                <bean class="de.spring.webservices.client.transport.http.CustomHttpRequestMessageSender" />
+                <bean class="de.spring.webservices.client.transport.http.CustomHttpRequestMessageSender">
+                       <constructor-arg>
+                               <bean class="org.springframework.http.client.SimpleClientHttpRequestFactory"
+                                       p:readTimeout="2000"
+                                       p:connectTimeout="1000" />
+                       </constructor-arg>
+                </bean>
             </list>
         </property>
     </bean>