类 WebServiceTemplateBuilder
- java.lang.Object
- org.springframework.boot.webservices.client.WebServiceTemplateBuilder
public class WebServiceTemplateBuilder extends Object
Builder that can be used to configure and create aWebServiceTemplate
. Provides convenience methods to registermessage senders
,client interceptors
andcustomizers
.By default the built
WebServiceTemplate
uses the most suitable HTTP-basedWebServiceMessageSender
, calldetectHttpMessageSender(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 aWebServiceTemplate
is needed.- 从以下版本开始:
- 2.1.0
构造器概要
构造器 构造器 说明 WebServiceTemplateBuilder(WebServiceTemplateCustomizer... customizers)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 WebServiceTemplateBuilder
additionalCustomizers(Collection<? extends WebServiceTemplateCustomizer> customizers)
Add additionalWebServiceTemplateCustomizers
that should be applied to theWebServiceTemplate
.WebServiceTemplateBuilder
additionalCustomizers(WebServiceTemplateCustomizer... customizers)
Add additionalWebServiceTemplateCustomizers
that should be applied to theWebServiceTemplate
.WebServiceTemplateBuilder
additionalInterceptors(Collection<? extends org.springframework.ws.client.support.interceptor.ClientInterceptor> interceptors)
Add additionalClientInterceptors
that should be used with theWebServiceTemplate
.WebServiceTemplateBuilder
additionalInterceptors(org.springframework.ws.client.support.interceptor.ClientInterceptor... interceptors)
Add additionalClientInterceptors
that should be used with theWebServiceTemplate
.WebServiceTemplateBuilder
additionalMessageSenders(Collection<? extends org.springframework.ws.transport.WebServiceMessageSender> messageSenders)
Add additionalWebServiceMessageSenders
that should be used with theWebServiceTemplate
.WebServiceTemplateBuilder
additionalMessageSenders(org.springframework.ws.transport.WebServiceMessageSender... messageSenders)
Add additionalWebServiceMessageSenders
that should be used with theWebServiceTemplate
.org.springframework.ws.client.core.WebServiceTemplate
build()
Build a newWebServiceTemplate
instance and configure it using this builder.<T extends org.springframework.ws.client.core.WebServiceTemplate>
Tbuild(Class<T> webServiceTemplateClass)
Build a newWebServiceTemplate
instance of the specified type and configure it using this builder.<T extends org.springframework.ws.client.core.WebServiceTemplate>
Tconfigure(T webServiceTemplate)
Configure the providedWebServiceTemplate
instance using this builder.WebServiceTemplateBuilder
customizers(Collection<? extends WebServiceTemplateCustomizer> customizers)
SetWebServiceTemplateCustomizers
that should be applied to theWebServiceTemplate
.WebServiceTemplateBuilder
customizers(WebServiceTemplateCustomizer... customizers)
SetWebServiceTemplateCustomizers
that should be applied to theWebServiceTemplate
.WebServiceTemplateBuilder
detectHttpMessageSender(boolean detectHttpMessageSender)
Set if a suitable HTTP-basedWebServiceMessageSender
should be detected based on the classpath.WebServiceTemplateBuilder
interceptors(Collection<? extends org.springframework.ws.client.support.interceptor.ClientInterceptor> interceptors)
Set theClientInterceptors
that should be used with theWebServiceTemplate
.WebServiceTemplateBuilder
interceptors(org.springframework.ws.client.support.interceptor.ClientInterceptor... interceptors)
Set theClientInterceptors
that should be used with theWebServiceTemplate
.WebServiceTemplateBuilder
messageSenders(Collection<? extends org.springframework.ws.transport.WebServiceMessageSender> messageSenders)
Sets theWebServiceMessageSenders
that should be used with theWebServiceTemplate
.WebServiceTemplateBuilder
messageSenders(org.springframework.ws.transport.WebServiceMessageSender... messageSenders)
Sets theWebServiceMessageSenders
that should be used with theWebServiceTemplate
.WebServiceTemplateBuilder
setCheckConnectionForError(boolean checkConnectionForError)
Indicates whether the connection should be checked for error indicators (true
), or whether these should be ignored (false
).WebServiceTemplateBuilder
setCheckConnectionForFault(boolean checkConnectionForFault)
Indicates whether the connection should be checked for fault indicators (true
), or whether we should rely on the message only (false
).WebServiceTemplateBuilder
setDefaultUri(String defaultUri)
Set the default URI to be used on operations that do not have a URI parameter.WebServiceTemplateBuilder
setDestinationProvider(org.springframework.ws.client.support.destination.DestinationProvider destinationProvider)
Set theDestinationProvider
to use.WebServiceTemplateBuilder
setFaultMessageResolver(org.springframework.ws.client.core.FaultMessageResolver faultMessageResolver)
Set theFaultMessageResolver
to use.WebServiceTemplateBuilder
setMarshaller(org.springframework.oxm.Marshaller marshaller)
Set theMarshaller
to use to serialize messages.WebServiceTemplateBuilder
setTransformerFactoryClass(Class<? extends TransformerFactory> transformerFactoryClass)
Set theTransformerFactory
implementation to use.WebServiceTemplateBuilder
setUnmarshaller(org.springframework.oxm.Unmarshaller unmarshaller)
Set theUnmarshaller
to use to deserialize messages.WebServiceTemplateBuilder
setWebServiceMessageFactory(org.springframework.ws.WebServiceMessageFactory messageFactory)
Sets theWebServiceMessageFactory
to use for creating messages.
构造器详细资料
WebServiceTemplateBuilder
public WebServiceTemplateBuilder(WebServiceTemplateCustomizer... customizers)
方法详细资料
detectHttpMessageSender
public WebServiceTemplateBuilder detectHttpMessageSender(boolean detectHttpMessageSender)
Set if a suitable HTTP-basedWebServiceMessageSender
should be detected based on the classpath. Default istrue
.- 参数:
detectHttpMessageSender
- if a HTTP-basedWebServiceMessageSender
should be detected- 返回:
- a new builder instance
- 另请参阅:
HttpWebServiceMessageSenderBuilder
messageSenders
public WebServiceTemplateBuilder messageSenders(org.springframework.ws.transport.WebServiceMessageSender... messageSenders)
Sets theWebServiceMessageSenders
that 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.
- 另请参阅:
additionalMessageSenders(WebServiceMessageSender...)
,detectHttpMessageSender(boolean)
messageSenders
public WebServiceTemplateBuilder messageSenders(Collection<? extends org.springframework.ws.transport.WebServiceMessageSender> messageSenders)
Sets theWebServiceMessageSenders
that 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(Collection)
,detectHttpMessageSender(boolean)
additionalMessageSenders
public WebServiceTemplateBuilder additionalMessageSenders(org.springframework.ws.transport.WebServiceMessageSender... messageSenders)
Add additionalWebServiceMessageSenders
that should be used with theWebServiceTemplate
.- 参数:
messageSenders
- the message senders to add- 返回:
- a new builder instance.
- 另请参阅:
messageSenders(WebServiceMessageSender...)
additionalMessageSenders
public WebServiceTemplateBuilder additionalMessageSenders(Collection<? extends org.springframework.ws.transport.WebServiceMessageSender> messageSenders)
Add additionalWebServiceMessageSenders
that should be used with theWebServiceTemplate
.- 参数:
messageSenders
- the message senders to add- 返回:
- a new builder instance.
- 另请参阅:
messageSenders(Collection)
interceptors
public WebServiceTemplateBuilder interceptors(org.springframework.ws.client.support.interceptor.ClientInterceptor... interceptors)
Set theClientInterceptors
that should be used with theWebServiceTemplate
. Setting this value will replace any previously defined interceptors.- 参数:
interceptors
- the interceptors to set- 返回:
- a new builder instance
- 另请参阅:
additionalInterceptors(ClientInterceptor...)
interceptors
public WebServiceTemplateBuilder interceptors(Collection<? extends org.springframework.ws.client.support.interceptor.ClientInterceptor> interceptors)
Set theClientInterceptors
that should be used with theWebServiceTemplate
. Setting this value will replace any previously defined interceptors.- 参数:
interceptors
- the interceptors to set- 返回:
- a new builder instance
- 另请参阅:
additionalInterceptors(Collection)
additionalInterceptors
public WebServiceTemplateBuilder additionalInterceptors(org.springframework.ws.client.support.interceptor.ClientInterceptor... interceptors)
Add additionalClientInterceptors
that should be used with theWebServiceTemplate
.- 参数:
interceptors
- the interceptors to add- 返回:
- a new builder instance
- 另请参阅:
interceptors(ClientInterceptor...)
additionalInterceptors
public WebServiceTemplateBuilder additionalInterceptors(Collection<? extends org.springframework.ws.client.support.interceptor.ClientInterceptor> interceptors)
Add additionalClientInterceptors
that should be used with theWebServiceTemplate
.- 参数:
interceptors
- the interceptors to add- 返回:
- a new builder instance
- 另请参阅:
interceptors(Collection)
customizers
public WebServiceTemplateBuilder customizers(WebServiceTemplateCustomizer... customizers)
SetWebServiceTemplateCustomizers
that 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(WebServiceTemplateCustomizer...)
customizers
public WebServiceTemplateBuilder customizers(Collection<? extends WebServiceTemplateCustomizer> customizers)
SetWebServiceTemplateCustomizers
that 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(Collection)
additionalCustomizers
public WebServiceTemplateBuilder additionalCustomizers(WebServiceTemplateCustomizer... customizers)
Add additionalWebServiceTemplateCustomizers
that 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
- 另请参阅:
customizers(WebServiceTemplateCustomizer...)
additionalCustomizers
public WebServiceTemplateBuilder additionalCustomizers(Collection<? extends WebServiceTemplateCustomizer> customizers)
Add additionalWebServiceTemplateCustomizers
that 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
- 另请参阅:
customizers(Collection)
setCheckConnectionForFault
public WebServiceTemplateBuilder setCheckConnectionForFault(boolean checkConnectionForFault)
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.
- 另请参阅:
WebServiceTemplate.setCheckConnectionForFault(boolean)
setCheckConnectionForError
public WebServiceTemplateBuilder setCheckConnectionForError(boolean checkConnectionForError)
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.
- 另请参阅:
WebServiceTemplate.setCheckConnectionForError(boolean)
setWebServiceMessageFactory
public WebServiceTemplateBuilder setWebServiceMessageFactory(org.springframework.ws.WebServiceMessageFactory messageFactory)
Sets theWebServiceMessageFactory
to use for creating messages.- 参数:
messageFactory
- the message factory to use for creating messages- 返回:
- a new builder instance.
- 另请参阅:
WebServiceAccessor.setMessageFactory(WebServiceMessageFactory)
setUnmarshaller
public WebServiceTemplateBuilder setUnmarshaller(org.springframework.oxm.Unmarshaller unmarshaller)
Set theUnmarshaller
to use to deserialize messages.- 参数:
unmarshaller
- the message unmarshaller- 返回:
- a new builder instance.
- 另请参阅:
WebServiceTemplate.setUnmarshaller(Unmarshaller)
setMarshaller
public WebServiceTemplateBuilder setMarshaller(org.springframework.oxm.Marshaller marshaller)
Set theMarshaller
to use to serialize messages.- 参数:
marshaller
- the message marshaller- 返回:
- a new builder instance.
- 另请参阅:
WebServiceTemplate.setMarshaller(Marshaller)
setFaultMessageResolver
public WebServiceTemplateBuilder setFaultMessageResolver(org.springframework.ws.client.core.FaultMessageResolver faultMessageResolver)
Set theFaultMessageResolver
to use.- 参数:
faultMessageResolver
- the fault message resolver to use- 返回:
- a new builder instance.
- 另请参阅:
WebServiceTemplate.setFaultMessageResolver(FaultMessageResolver)
setTransformerFactoryClass
public WebServiceTemplateBuilder setTransformerFactoryClass(Class<? extends TransformerFactory> transformerFactoryClass)
Set theTransformerFactory
implementation to use.- 参数:
transformerFactoryClass
- the transformer factory implementation to use- 返回:
- a new builder instance.
- 另请参阅:
TransformerObjectSupport.setTransformerFactoryClass(Class)
setDefaultUri
public WebServiceTemplateBuilder setDefaultUri(String defaultUri)
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(DestinationProvider)
setDestinationProvider
public WebServiceTemplateBuilder setDestinationProvider(org.springframework.ws.client.support.destination.DestinationProvider destinationProvider)
Set theDestinationProvider
to 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.
- 另请参阅:
WebServiceTemplate.setDestinationProvider(DestinationProvider)
build
public org.springframework.ws.client.core.WebServiceTemplate build()
Build a newWebServiceTemplate
instance and configure it using this builder.- 返回:
- a configured
WebServiceTemplate
instance. - 另请参阅:
build(Class)
,configure(WebServiceTemplate)
build
public <T extends org.springframework.ws.client.core.WebServiceTemplate> T build(Class<T> webServiceTemplateClass)
Build a newWebServiceTemplate
instance 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
WebServiceTemplate
instance. - 另请参阅:
build()
,configure(WebServiceTemplate)
configure
public <T extends org.springframework.ws.client.core.WebServiceTemplate> T configure(T webServiceTemplate)
Configure the providedWebServiceTemplate
instance using this builder.- 类型参数:
T
- the type of web service template- 参数:
webServiceTemplate
- theWebServiceTemplate
to configure- 返回:
- the web service template instance
- 另请参阅:
build()
,build(Class)