Update web services documentation and samples
Closes gh-42887
This commit is contained in:
parent
2208c67f22
commit
39da14ea80
|
@ -30,6 +30,8 @@ The following code shows a typical example:
|
|||
include-code::MyService[]
|
||||
|
||||
By default, `WebServiceTemplateBuilder` detects a suitable HTTP-based `WebServiceMessageSender` using the available HTTP client libraries on the classpath.
|
||||
You can also customize read and connection timeouts as follows:
|
||||
You can also customize read and connection timeouts for an individual builder as follows:
|
||||
|
||||
include-code::MyWebServiceTemplateConfiguration[]
|
||||
|
||||
TIP: You can also change the xref:io/rest-client.adoc#io.rest-client.clienthttprequestfactory.configuration[global HTTP client configuration] used if not specific template customization code is applied.
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.springframework.boot.webservices.client.WebServiceTemplateBuilder;
|
|||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.ws.client.core.WebServiceTemplate;
|
||||
import org.springframework.ws.transport.WebServiceMessageSender;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class MyWebServiceTemplateConfiguration {
|
||||
|
@ -34,8 +33,8 @@ public class MyWebServiceTemplateConfiguration {
|
|||
ClientHttpRequestFactorySettings settings = ClientHttpRequestFactorySettings.defaults()
|
||||
.withConnectTimeout(Duration.ofSeconds(2))
|
||||
.withReadTimeout(Duration.ofSeconds(2));
|
||||
WebServiceMessageSender sender = WebServiceMessageSenderFactory.http(settings).getWebServiceMessageSender();
|
||||
return builder.messageSenders(sender).build();
|
||||
builder.httpMessageSenderFactory(WebServiceMessageSenderFactory.http(settings));
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,10 +30,10 @@ class MyWebServiceTemplateConfiguration {
|
|||
@Bean
|
||||
fun webServiceTemplate(builder: WebServiceTemplateBuilder): WebServiceTemplate {
|
||||
val settings = ClientHttpRequestFactorySettings.defaults()
|
||||
.withConnectTimeout(Duration.ofSeconds(2))
|
||||
.withReadTimeout(Duration.ofSeconds(2));
|
||||
val sender = WebServiceMessageSenderFactory.http(settings).getWebServiceMessageSender();
|
||||
return builder.messageSenders(sender).build();
|
||||
.withConnectTimeout(Duration.ofSeconds(2))
|
||||
.withReadTimeout(Duration.ofSeconds(2))
|
||||
builder.httpMessageSenderFactory(WebServiceMessageSenderFactory.http(settings))
|
||||
return builder.build()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue