Class AxiomSoapMessageFactory
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
,SoapMessageFactory
,WebServiceMessageFactory
WebServiceMessageFactory
interface. Creates AxiomSoapMessages
.
To increase reading performance on the SOAP request created by this message factory,
you can set the payloadCaching
property to
false
(default is true
). This this will read the contents of the body
directly from the stream. However, when this setting is enabled, the payload
can only be read once. This means that any endpoint mappings or interceptors
which are based on the message payload (such as the
PayloadRootAnnotationMethodEndpointMapping
, the
PayloadValidatingInterceptor
, or the PayloadLoggingInterceptor
) cannot
be used. Instead, use an endpoint mapping that does not consume the payload (i.e. the
SoapActionAnnotationMethodEndpointMapping
).
Additionally, this message factory can cache large attachments to disk by setting the
attachmentCaching
property to true
(default is false
). Optionally, the location where attachments are stored can
be defined via the attachmentCacheDir
property
(defaults to the system temp file path).
Mostly derived from org.apache.axis2.transport.http.HTTPTransportUtils
and
org.apache.axis2.transport.TransportUtils
, which we cannot use since they are
not part of the Axiom distribution.
- Since:
- 1.0.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Creates a new, emptySoapMessage
.createWebServiceMessage
(InputStream inputStream) Reads aSoapMessage
from the given input stream.protected XMLInputFactory
Create aXMLInputFactory
that this resolver will use to createXMLStreamReader
objects.protected String
getCharSetEncoding
(String contentType) Returns the character set from the given content type.void
setAttachmentCacheDir
(File attachmentCacheDir) Sets the directory where SOAP attachments will be stored.void
setAttachmentCacheThreshold
(int attachmentCacheThreshold) Sets the threshold for attachments caching, in bytes.void
setAttachmentCaching
(boolean attachmentCaching) Indicates whether SOAP attachments should be cached or not.void
setLangAttributeOnSoap11FaultString
(boolean langAttributeOnSoap11FaultString) Defines whether axml:lang
attribute should be set on SOAP 1.1<faultstring>
elements.void
setPayloadCaching
(boolean payloadCaching) Indicates whether the SOAP Body payload should be cached or not.void
setReplacingEntityReferences
(boolean replacingEntityReferences) Sets whether internal entity references should be replaced with their replacement text and report them as characters.void
setSoapVersion
(SoapVersion version) Sets the SOAP Version used by this factory.void
setSupportingExternalEntities
(boolean supportingExternalEntities) Sets whether external parsed entities should be resolved.toString()
-
Constructor Details
-
AxiomSoapMessageFactory
public AxiomSoapMessageFactory()
-
-
Method Details
-
setPayloadCaching
public void setPayloadCaching(boolean payloadCaching) Indicates whether the SOAP Body payload should be cached or not. Default istrue
.Setting this to
false
will increase performance, but also result in the fact that the message payload can only be read once. -
setAttachmentCaching
public void setAttachmentCaching(boolean attachmentCaching) Indicates whether SOAP attachments should be cached or not. Default isfalse
.Setting this to
true
will cause Axiom to store larger attachments on disk, rather than in memory. This decreases memory consumption, but decreases performance. -
setAttachmentCacheDir
Sets the directory where SOAP attachments will be stored. Only used whenattachmentCaching
is set totrue
.The parameter should be an existing, writable directory. This property defaults to the temporary directory of the operating system (i.e. the value of the
java.io.tmpdir
system property). -
setAttachmentCacheThreshold
public void setAttachmentCacheThreshold(int attachmentCacheThreshold) Sets the threshold for attachments caching, in bytes. Attachments larger than this threshold will be cached in theattachment cache directory
. Only used whenattachmentCaching
is set totrue
.Defaults to 4096 bytes (i.e. 4 kilobytes).
-
setSoapVersion
Description copied from interface:SoapMessageFactory
Sets the SOAP Version used by this factory.- Specified by:
setSoapVersion
in interfaceSoapMessageFactory
- Parameters:
version
- the version constant- See Also:
-
setLangAttributeOnSoap11FaultString
public void setLangAttributeOnSoap11FaultString(boolean langAttributeOnSoap11FaultString) Defines whether axml:lang
attribute should be set on SOAP 1.1<faultstring>
elements.The default is
true
, to comply with WS-I, but this flag can be set tofalse
to the older W3C SOAP 1.1 specification.- See Also:
-
setReplacingEntityReferences
public void setReplacingEntityReferences(boolean replacingEntityReferences) Sets whether internal entity references should be replaced with their replacement text and report them as characters. -
setSupportingExternalEntities
public void setSupportingExternalEntities(boolean supportingExternalEntities) Sets whether external parsed entities should be resolved. -
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
createWebServiceMessage
Description copied from interface:SoapMessageFactory
Creates a new, emptySoapMessage
.- Specified by:
createWebServiceMessage
in interfaceSoapMessageFactory
- Specified by:
createWebServiceMessage
in interfaceWebServiceMessageFactory
- Returns:
- the empty message
-
createWebServiceMessage
Description copied from interface:SoapMessageFactory
Reads aSoapMessage
from the given input stream.If the given stream is an instance of
TransportInputStream
, the headers will be read from the request.- Specified by:
createWebServiceMessage
in interfaceSoapMessageFactory
- Specified by:
createWebServiceMessage
in interfaceWebServiceMessageFactory
- Parameters:
inputStream
- the input stream to read the message from- Returns:
- the created message
- Throws:
IOException
- if an I/O exception occurs
-
getCharSetEncoding
Returns the character set from the given content type. Mostly copied- Returns:
- the character set encoding
-
createXmlInputFactory
Create aXMLInputFactory
that this resolver will use to createXMLStreamReader
objects.Can be overridden in subclasses, adding further initialization of the factory. The resulting factory is cached, so this method will only be called once.
By default this method creates a standard
XMLInputFactory
and configures it based on thereplacingEntityReferences
andsupportingExternalEntities
properties.- Returns:
- the created factory
-
toString
-