org.springframework.boot.webservices.client

Class WebServiceTemplateBuilder

  • java.lang.Object
    • org.springframework.boot.webservices.client.WebServiceTemplateBuilder


  • public class WebServiceTemplateBuilder
    extends Object
    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.

    Since:
    2.1.0
    Author:
    Dmytro Nosan, Stephane Nicoll
    • Method Detail

      • detectHttpMessageSender

        public WebServiceTemplateBuilder detectHttpMessageSender(boolean detectHttpMessageSender)
        Set if a suitable HTTP-based WebServiceMessageSender should be detected based on the classpath. Default is true.
        Parameters:
        detectHttpMessageSender - if a HTTP-based WebServiceMessageSender should be detected
        Returns:
        a new builder instance
        See Also:
        HttpWebServiceMessageSenderBuilder
      • additionalMessageSenders

        public WebServiceTemplateBuilder additionalMessageSenders(org.springframework.ws.transport.WebServiceMessageSender... messageSenders)
        Add additional WebServiceMessageSenders that should be used with the WebServiceTemplate.
        Parameters:
        messageSenders - the message senders to add
        Returns:
        a new builder instance.
        See Also:
        messageSenders(WebServiceMessageSender...)
      • additionalMessageSenders

        public WebServiceTemplateBuilder additionalMessageSenders(Collection<? extends org.springframework.ws.transport.WebServiceMessageSender> messageSenders)
        Add additional WebServiceMessageSenders that should be used with the WebServiceTemplate.
        Parameters:
        messageSenders - the message senders to add
        Returns:
        a new builder instance.
        See Also:
        messageSenders(Collection)
      • interceptors

        public WebServiceTemplateBuilder interceptors(org.springframework.ws.client.support.interceptor.ClientInterceptor... interceptors)
        Set the ClientInterceptors that should be used with the WebServiceTemplate. Setting this value will replace any previously defined interceptors.
        Parameters:
        interceptors - the interceptors to set
        Returns:
        a new builder instance
        See Also:
        additionalInterceptors(ClientInterceptor...)
      • interceptors

        public WebServiceTemplateBuilder interceptors(Collection<? extends org.springframework.ws.client.support.interceptor.ClientInterceptor> interceptors)
        Set the ClientInterceptors that should be used with the WebServiceTemplate. Setting this value will replace any previously defined interceptors.
        Parameters:
        interceptors - the interceptors to set
        Returns:
        a new builder instance
        See Also:
        additionalInterceptors(Collection)
      • additionalInterceptors

        public WebServiceTemplateBuilder additionalInterceptors(org.springframework.ws.client.support.interceptor.ClientInterceptor... interceptors)
        Add additional ClientInterceptors that should be used with the WebServiceTemplate.
        Parameters:
        interceptors - the interceptors to add
        Returns:
        a new builder instance
        See Also:
        interceptors(ClientInterceptor...)
      • additionalInterceptors

        public WebServiceTemplateBuilder additionalInterceptors(Collection<? extends org.springframework.ws.client.support.interceptor.ClientInterceptor> interceptors)
        Add additional ClientInterceptors that should be used with the WebServiceTemplate.
        Parameters:
        interceptors - the interceptors to add
        Returns:
        a new builder instance
        See Also:
        interceptors(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).
        Parameters:
        checkConnectionForFault - whether to check for fault indicators
        Returns:
        a new builder instance.
        See Also:
        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).
        Parameters:
        checkConnectionForError - whether to check for error indicators
        Returns:
        a new builder instance.
        See Also:
        WebServiceTemplate.setCheckConnectionForError(boolean)
      • setWebServiceMessageFactory

        public WebServiceTemplateBuilder setWebServiceMessageFactory(org.springframework.ws.WebServiceMessageFactory messageFactory)
        Sets the WebServiceMessageFactory to use for creating messages.
        Parameters:
        messageFactory - the message factory to use for creating messages
        Returns:
        a new builder instance.
        See Also:
        WebServiceAccessor.setMessageFactory(WebServiceMessageFactory)
      • setUnmarshaller

        public WebServiceTemplateBuilder setUnmarshaller(org.springframework.oxm.Unmarshaller unmarshaller)
        Set the Unmarshaller to use to deserialize messages.
        Parameters:
        unmarshaller - the message unmarshaller
        Returns:
        a new builder instance.
        See Also:
        WebServiceTemplate.setUnmarshaller(Unmarshaller)
      • setMarshaller

        public WebServiceTemplateBuilder setMarshaller(org.springframework.oxm.Marshaller marshaller)
        Set the Marshaller to use to serialize messages.
        Parameters:
        marshaller - the message marshaller
        Returns:
        a new builder instance.
        See Also:
        WebServiceTemplate.setMarshaller(Marshaller)
      • setFaultMessageResolver

        public WebServiceTemplateBuilder setFaultMessageResolver(org.springframework.ws.client.core.FaultMessageResolver faultMessageResolver)
        Set the FaultMessageResolver to use.
        Parameters:
        faultMessageResolver - the fault message resolver to use
        Returns:
        a new builder instance.
        See Also:
        WebServiceTemplate.setFaultMessageResolver(FaultMessageResolver)
      • setTransformerFactoryClass

        public WebServiceTemplateBuilder setTransformerFactoryClass(Class<? extends TransformerFactory> transformerFactoryClass)
        Set the TransformerFactory implementation to use.
        Parameters:
        transformerFactoryClass - the transformer factory implementation to use
        Returns:
        a new builder instance.
        See Also:
        TransformerObjectSupport.setTransformerFactoryClass(Class)
      • setDestinationProvider

        public WebServiceTemplateBuilder setDestinationProvider(org.springframework.ws.client.support.destination.DestinationProvider destinationProvider)
        Set the DestinationProvider to use. Typically, either this property is set, or setDefaultUri(String), but not both.
        Parameters:
        destinationProvider - the destination provider to be used on operations that do not have a URI parameter.
        Returns:
        a new builder instance.
        See Also:
        WebServiceTemplate.setDestinationProvider(DestinationProvider)
      • build

        public org.springframework.ws.client.core.WebServiceTemplate build()
        Build a new WebServiceTemplate instance and configure it using this builder.
        Returns:
        a configured WebServiceTemplate instance.
        See Also:
        build(Class), configure(WebServiceTemplate)
      • build

        public <T extends org.springframework.ws.client.core.WebServiceTemplate> T build(Class<T> webServiceTemplateClass)
        Build a new WebServiceTemplate instance of the specified type and configure it using this builder.
        Type Parameters:
        T - the type of web service template
        Parameters:
        webServiceTemplateClass - the template type to create
        Returns:
        a configured WebServiceTemplate instance.
        See Also:
        build(), configure(WebServiceTemplate)
      • configure

        public <T extends org.springframework.ws.client.core.WebServiceTemplate> T configure(T webServiceTemplate)
        Configure the provided WebServiceTemplate instance using this builder.
        Type Parameters:
        T - the type of web service template
        Parameters:
        webServiceTemplate - the WebServiceTemplate to configure
        Returns:
        the web service template instance
        See Also:
        build(), build(Class)

Copyright © 2018 Pivotal Software, Inc.. All rights reserved.