Package org.springframework.ws.mime
Interface MimeMessage
- All Superinterfaces:
WebServiceMessage
- All Known Subinterfaces:
SoapMessage
- All Known Implementing Classes:
AbstractMimeMessage
,AbstractSoapMessage
,SaajSoapMessage
Represents a Web service message with MIME attachments. Attachments can be added as a file, an
InputStreamSource
, or a DataHandler
.- Since:
- 1.0.0
- Author:
- Arjen Poutsma
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionaddAttachment
(String contentId, jakarta.activation.DataHandler dataHandler) Add an attachment to the message, taking the content from aDataHandler
.addAttachment
(String contentId, File file) Add an attachment to the message, taking the content from aFile
.addAttachment
(String contentId, org.springframework.core.io.InputStreamSource inputStreamSource, String contentType) Add an attachment to the message, taking the content from anInputStreamSource
.boolean
Turns this message into a XOP package.getAttachment
(String contentId) Returns theAttachment
with the specified content Id.Returns anIterator
over allAttachment
objects that are part of this message.boolean
Indicates whether this message is a XOP package.Methods inherited from interface org.springframework.ws.WebServiceMessage
getPayloadResult, getPayloadSource, writeTo
-
Method Details
-
isXopPackage
boolean isXopPackage()Indicates whether this message is a XOP package.- Returns:
true
when the constraints specified in Identifying XOP Documents are met.- See Also:
-
convertToXopPackage
boolean convertToXopPackage()Turns this message into a XOP package.- Returns:
true
when the message is a XOP package- See Also:
-
getAttachment
Returns theAttachment
with the specified content Id.- Returns:
- the attachment with the specified content id; or
null
if it cannot be found - Throws:
AttachmentException
- in case of errors
-
getAttachments
Returns anIterator
over allAttachment
objects that are part of this message.- Returns:
- an iterator over all attachments
- Throws:
AttachmentException
- in case of errors- See Also:
-
addAttachment
Add an attachment to the message, taking the content from aFile
.The content type will be determined by the name of the given content file. Do not use this for temporary files with arbitrary filenames (possibly ending in ".tmp" or the like)!
- Parameters:
contentId
- the content Id of the attachmentfile
- the file to take the content from- Returns:
- the added attachment
- Throws:
AttachmentException
- in case of errors
-
addAttachment
Attachment addAttachment(String contentId, org.springframework.core.io.InputStreamSource inputStreamSource, String contentType) Add an attachment to the message, taking the content from anInputStreamSource
.Note that the stream returned by the source needs to be a fresh one on each call, as underlying implementations can invoke
InputStreamSource.getInputStream()
multiple times.- Parameters:
contentId
- the content Id of the attachmentinputStreamSource
- the resource to take the content from (all of Spring's Resource implementations can be passed in here)contentType
- the content type to use for the element- Returns:
- the added attachment
- Throws:
AttachmentException
- in case of errors- See Also:
-
Resource
-
addAttachment
Add an attachment to the message, taking the content from aDataHandler
.- Parameters:
dataHandler
- the data handler to take the content from- Returns:
- the added attachment
- Throws:
AttachmentException
- in case of errors
-