类 WebServiceTemplateBuilder
java.lang.Object
org.springframework.boot.webservices.client.WebServiceTemplateBuilder
Builder that can be used to configure and create a
WebServiceTemplate. Provides
convenience methods to register message senders, client interceptors and
customizers.
By default the built WebServiceTemplate uses the most suitable HTTP-based
WebServiceMessageSender, call detectHttpMessageSender(false) if you prefer to keep the default. In a typical
auto-configured Spring Boot application this builder is available as a bean and can be
injected whenever a WebServiceTemplate is needed.
- 从以下版本开始:
- 2.1.0
- 作者:
- Dmytro Nosan, Stephane Nicoll
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明additionalCustomizers(Collection<? extends WebServiceTemplateCustomizer> customizers) Add additionalWebServiceTemplateCustomizersthat should be applied to theWebServiceTemplate.additionalCustomizers(WebServiceTemplateCustomizer... customizers) Add additionalWebServiceTemplateCustomizersthat should be applied to theWebServiceTemplate.additionalInterceptors(Collection<? extends org.springframework.ws.client.support.interceptor.ClientInterceptor> interceptors) Add additionalClientInterceptorsthat should be used with theWebServiceTemplate.additionalInterceptors(org.springframework.ws.client.support.interceptor.ClientInterceptor... interceptors) Add additionalClientInterceptorsthat should be used with theWebServiceTemplate.additionalMessageSenders(Collection<? extends org.springframework.ws.transport.WebServiceMessageSender> messageSenders) Add additionalWebServiceMessageSendersthat should be used with theWebServiceTemplate.additionalMessageSenders(org.springframework.ws.transport.WebServiceMessageSender... messageSenders) Add additionalWebServiceMessageSendersthat should be used with theWebServiceTemplate.org.springframework.ws.client.core.WebServiceTemplatebuild()Build a newWebServiceTemplateinstance and configure it using this builder.<T extends org.springframework.ws.client.core.WebServiceTemplate>
TBuild a newWebServiceTemplateinstance of the specified type and configure it using this builder.<T extends org.springframework.ws.client.core.WebServiceTemplate>
Tconfigure(T webServiceTemplate) Configure the providedWebServiceTemplateinstance using this builder.customizers(Collection<? extends WebServiceTemplateCustomizer> customizers) SetWebServiceTemplateCustomizersthat should be applied to theWebServiceTemplate.customizers(WebServiceTemplateCustomizer... customizers) SetWebServiceTemplateCustomizersthat should be applied to theWebServiceTemplate.detectHttpMessageSender(boolean detectHttpMessageSender) Set if a suitable HTTP-basedWebServiceMessageSendershould be detected based on the classpath when one has not been specified.httpMessageSenderFactory(WebServiceMessageSenderFactory messageSenderFactory) Set theWebServiceMessageSenderFactorythat should be used to send HTTP messages.interceptors(Collection<? extends org.springframework.ws.client.support.interceptor.ClientInterceptor> interceptors) Set theClientInterceptorsthat should be used with theWebServiceTemplate.interceptors(org.springframework.ws.client.support.interceptor.ClientInterceptor... interceptors) Set theClientInterceptorsthat should be used with theWebServiceTemplate.messageSenders(Collection<? extends org.springframework.ws.transport.WebServiceMessageSender> messageSenders) Sets theWebServiceMessageSendersthat should be used with theWebServiceTemplate.messageSenders(org.springframework.ws.transport.WebServiceMessageSender... messageSenders) Sets theWebServiceMessageSendersthat should be used with theWebServiceTemplate.setCheckConnectionForError(boolean checkConnectionForError) Indicates whether the connection should be checked for error indicators (true), or whether these should be ignored (false).setCheckConnectionForFault(boolean checkConnectionForFault) Indicates whether the connection should be checked for fault indicators (true), or whether we should rely on the message only (false).setDefaultUri(String defaultUri) Set the default URI to be used on operations that do not have a URI parameter.setDestinationProvider(org.springframework.ws.client.support.destination.DestinationProvider destinationProvider) Set theDestinationProviderto use.setFaultMessageResolver(org.springframework.ws.client.core.FaultMessageResolver faultMessageResolver) Set theFaultMessageResolverto use.setMarshaller(Marshaller marshaller) Set theMarshallerto use to serialize messages.setTransformerFactoryClass(Class<? extends TransformerFactory> transformerFactoryClass) Set theTransformerFactoryimplementation to use.setUnmarshaller(Unmarshaller unmarshaller) Set theUnmarshallerto use to deserialize messages.setWebServiceMessageFactory(org.springframework.ws.WebServiceMessageFactory messageFactory) Sets theWebServiceMessageFactoryto use for creating messages.
-
构造器详细资料
-
WebServiceTemplateBuilder
-
-
方法详细资料
-
httpMessageSenderFactory
public WebServiceTemplateBuilder httpMessageSenderFactory(WebServiceMessageSenderFactory messageSenderFactory) Set theWebServiceMessageSenderFactorythat should be used to send HTTP messages.- 参数:
messageSenderFactory- theWebServiceMessageSenderFactoryto use- 返回:
- a new builder instance
- 从以下版本开始:
- 3.4.0
- 另请参阅:
-
detectHttpMessageSender
Set if a suitable HTTP-basedWebServiceMessageSendershould be detected based on the classpath when one has not been specified. Default istrue.- 参数:
detectHttpMessageSender- if an HTTP-basedWebServiceMessageSendershould be detected- 返回:
- a new builder instance
- 另请参阅:
-
messageSenders
public WebServiceTemplateBuilder messageSenders(org.springframework.ws.transport.WebServiceMessageSender... messageSenders) Sets theWebServiceMessageSendersthat should be used with theWebServiceTemplate. Setting this value will replace any previously defined message senders, including the HTTP-based message sender, if any. Consider usingadditionalMessageSenders(WebServiceMessageSender...)to keep it with user-defined message senders.- 参数:
messageSenders- the message senders to set- 返回:
- a new builder instance.
- 另请参阅:
-
messageSenders
public WebServiceTemplateBuilder messageSenders(Collection<? extends org.springframework.ws.transport.WebServiceMessageSender> messageSenders) Sets theWebServiceMessageSendersthat should be used with theWebServiceTemplate. Setting this value will replace any previously defined message senders, including the HTTP-based message sender, if any. Consider usingadditionalMessageSenders(Collection)to keep it with user-defined message senders.- 参数:
messageSenders- the message senders to set- 返回:
- a new builder instance.
- 另请参阅:
-
additionalMessageSenders
public WebServiceTemplateBuilder additionalMessageSenders(org.springframework.ws.transport.WebServiceMessageSender... messageSenders) Add additionalWebServiceMessageSendersthat should be used with theWebServiceTemplate.- 参数:
messageSenders- the message senders to add- 返回:
- a new builder instance.
- 另请参阅:
-
additionalMessageSenders
public WebServiceTemplateBuilder additionalMessageSenders(Collection<? extends org.springframework.ws.transport.WebServiceMessageSender> messageSenders) Add additionalWebServiceMessageSendersthat should be used with theWebServiceTemplate.- 参数:
messageSenders- the message senders to add- 返回:
- a new builder instance.
- 另请参阅:
-
interceptors
public WebServiceTemplateBuilder interceptors(org.springframework.ws.client.support.interceptor.ClientInterceptor... interceptors) Set theClientInterceptorsthat should be used with theWebServiceTemplate. Setting this value will replace any previously defined interceptors.- 参数:
interceptors- the interceptors to set- 返回:
- a new builder instance
- 另请参阅:
-
interceptors
public WebServiceTemplateBuilder interceptors(Collection<? extends org.springframework.ws.client.support.interceptor.ClientInterceptor> interceptors) Set theClientInterceptorsthat should be used with theWebServiceTemplate. Setting this value will replace any previously defined interceptors.- 参数:
interceptors- the interceptors to set- 返回:
- a new builder instance
- 另请参阅:
-
additionalInterceptors
public WebServiceTemplateBuilder additionalInterceptors(org.springframework.ws.client.support.interceptor.ClientInterceptor... interceptors) Add additionalClientInterceptorsthat should be used with theWebServiceTemplate.- 参数:
interceptors- the interceptors to add- 返回:
- a new builder instance
- 另请参阅:
-
additionalInterceptors
public WebServiceTemplateBuilder additionalInterceptors(Collection<? extends org.springframework.ws.client.support.interceptor.ClientInterceptor> interceptors) Add additionalClientInterceptorsthat should be used with theWebServiceTemplate.- 参数:
interceptors- the interceptors to add- 返回:
- a new builder instance
- 另请参阅:
-
customizers
SetWebServiceTemplateCustomizersthat should be applied to theWebServiceTemplate. Customizers are applied in the order that they were added after builder configuration has been applied. Setting this value will replace any previously configured customizers.- 参数:
customizers- the customizers to set- 返回:
- a new builder instance
- 另请参阅:
-
customizers
public WebServiceTemplateBuilder customizers(Collection<? extends WebServiceTemplateCustomizer> customizers) SetWebServiceTemplateCustomizersthat should be applied to theWebServiceTemplate. Customizers are applied in the order that they were added after builder configuration has been applied. Setting this value will replace any previously configured customizers.- 参数:
customizers- the customizers to set- 返回:
- a new builder instance
- 另请参阅:
-
additionalCustomizers
Add additionalWebServiceTemplateCustomizersthat should be applied to theWebServiceTemplate. Customizers are applied in the order that they were added after builder configuration has been applied.- 参数:
customizers- the customizers to add- 返回:
- a new builder instance
- 另请参阅:
-
additionalCustomizers
public WebServiceTemplateBuilder additionalCustomizers(Collection<? extends WebServiceTemplateCustomizer> customizers) Add additionalWebServiceTemplateCustomizersthat should be applied to theWebServiceTemplate. Customizers are applied in the order that they were added after builder configuration has been applied.- 参数:
customizers- the customizers to add- 返回:
- a new builder instance
- 另请参阅:
-
setCheckConnectionForFault
Indicates whether the connection should be checked for fault indicators (true), or whether we should rely on the message only (false).- 参数:
checkConnectionForFault- whether to check for fault indicators- 返回:
- a new builder instance.
- 另请参阅:
-
setCheckConnectionForError
Indicates whether the connection should be checked for error indicators (true), or whether these should be ignored (false).- 参数:
checkConnectionForError- whether to check for error indicators- 返回:
- a new builder instance.
- 另请参阅:
-
setWebServiceMessageFactory
public WebServiceTemplateBuilder setWebServiceMessageFactory(org.springframework.ws.WebServiceMessageFactory messageFactory) Sets theWebServiceMessageFactoryto use for creating messages.- 参数:
messageFactory- the message factory to use for creating messages- 返回:
- a new builder instance.
- 另请参阅:
-
setUnmarshaller
Set theUnmarshallerto use to deserialize messages.- 参数:
unmarshaller- the message unmarshaller- 返回:
- a new builder instance.
- 另请参阅:
-
setMarshaller
Set theMarshallerto use to serialize messages.- 参数:
marshaller- the message marshaller- 返回:
- a new builder instance.
- 另请参阅:
-
setFaultMessageResolver
public WebServiceTemplateBuilder setFaultMessageResolver(org.springframework.ws.client.core.FaultMessageResolver faultMessageResolver) Set theFaultMessageResolverto use.- 参数:
faultMessageResolver- the fault message resolver to use- 返回:
- a new builder instance.
- 另请参阅:
-
setTransformerFactoryClass
public WebServiceTemplateBuilder setTransformerFactoryClass(Class<? extends TransformerFactory> transformerFactoryClass) Set theTransformerFactoryimplementation to use.- 参数:
transformerFactoryClass- the transformer factory implementation to use- 返回:
- a new builder instance.
- 另请参阅:
-
setDefaultUri
Set the default URI to be used on operations that do not have a URI parameter. Typically, either this property is set, orsetDestinationProvider(DestinationProvider), but not both.- 参数:
defaultUri- the destination provider URI to be used on operations that do not have a URI parameter.- 返回:
- a new builder instance.
- 另请参阅:
-
setDestinationProvider
public WebServiceTemplateBuilder setDestinationProvider(org.springframework.ws.client.support.destination.DestinationProvider destinationProvider) Set theDestinationProviderto use. Typically, either this property is set, orsetDefaultUri(String), but not both.- 参数:
destinationProvider- the destination provider to be used on operations that do not have a URI parameter.- 返回:
- a new builder instance.
- 另请参阅:
-
build
public org.springframework.ws.client.core.WebServiceTemplate build()Build a newWebServiceTemplateinstance and configure it using this builder.- 返回:
- a configured
WebServiceTemplateinstance. - 另请参阅:
-
build
public <T extends org.springframework.ws.client.core.WebServiceTemplate> T build(Class<T> webServiceTemplateClass) Build a newWebServiceTemplateinstance of the specified type and configure it using this builder.- 类型参数:
T- the type of web service template- 参数:
webServiceTemplateClass- the template type to create- 返回:
- a configured
WebServiceTemplateinstance. - 另请参阅:
-
configure
public <T extends org.springframework.ws.client.core.WebServiceTemplate> T configure(T webServiceTemplate) Configure the providedWebServiceTemplateinstance using this builder.- 类型参数:
T- the type of web service template- 参数:
webServiceTemplate- theWebServiceTemplateto configure- 返回:
- the web service template instance
- 另请参阅:
-