Spring Web Services Framework

org.springframework.ws.mime
Interface MimeMessage

All Superinterfaces:
WebServiceMessage
All Known Subinterfaces:
SoapMessage
All Known Implementing Classes:
AbstractMimeMessage, AbstractSoapMessage, AxiomSoapMessage, SaajSoapMessage

public interface MimeMessage
extends WebServiceMessage

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:
Attachment

Method Summary
 Attachment addAttachment(String contentId, DataHandler dataHandler)
          Add an attachment to the message, taking the content from a DataHandler.
 Attachment addAttachment(String contentId, File file)
          Add an attachment to the message, taking the content from a File.
 Attachment addAttachment(String contentId, InputStreamSource inputStreamSource, String contentType)
          Add an attachment to the message, taking the content from an InputStreamSource.
 boolean convertToXopPackage()
          Turns this message into a XOP package.
 Attachment getAttachment(String contentId)
          Returns the Attachment with the specified content Id.
 Iterator<Attachment> getAttachments()
          Returns an Iterator over all Attachment objects that are part of this message.
 boolean isXopPackage()
          Indicates whether this message is a XOP package.
 
Methods inherited from interface org.springframework.ws.WebServiceMessage
getPayloadResult, getPayloadSource, writeTo
 

Method Detail

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:
XOP Packages

convertToXopPackage

boolean convertToXopPackage()
Turns this message into a XOP package.

Returns:
true when the message is a XOP package
See Also:
XOP Packages

getAttachment

Attachment getAttachment(String contentId)
                         throws AttachmentException
Returns the Attachment 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

Iterator<Attachment> getAttachments()
                                    throws AttachmentException
Returns an Iterator over all Attachment objects that are part of this message.

Returns:
an iterator over all attachments
Throws:
AttachmentException - in case of errors
See Also:
Attachment

addAttachment

Attachment addAttachment(String contentId,
                         File file)
                         throws AttachmentException
Add an attachment to the message, taking the content from a File.

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 attachment
file - the file to take the content from
Returns:
the added attachment
Throws:
AttachmentException - in case of errors

addAttachment

Attachment addAttachment(String contentId,
                         InputStreamSource inputStreamSource,
                         String contentType)
Add an attachment to the message, taking the content from an InputStreamSource.

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 attachment
inputStreamSource - 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

Attachment addAttachment(String contentId,
                         DataHandler dataHandler)
Add an attachment to the message, taking the content from a DataHandler.

Parameters:
dataHandler - the data handler to take the content from
Returns:
the added attachment
Throws:
AttachmentException - in case of errors

Spring Web Services Framework

Copyright © 2005-2013 The Spring Web Services Framework. All Rights Reserved.