There are two types of packaging models for SOAP messages: with and without attachments. JAXM provides a standard way of creating and consuming both types of SOAP messages. SOAP Message with Attachments Figure 7.7 represents a JAXM message with attachments. Depending upon the application requirements, a JAXM application can choose to create or consume a SOAP message with attachments. For example, with the asynchronous update with acknowledgment message category, an acknowledgment message is sent to the requesting client. This acknowledgment need not have an attachment part. However, if an application needs to send an image file, then it will have to create a SOAP message with attachment, because an image file is non-XML data and can be sent only as an attachment. It is important to remember that a JAXM client that receives a message is required to identify and process the attachment part of a message. A message that contains attachments must necessarily contain a MIME envelope. This envelope contains the SOAP part of the message as well as the attachment part. The MIME envelope is automatically created when the client creates an attachment and the JavaBeans Activation Framework (JAF) is used to provide a flexible way to handle attachments based on MIME types. SOAP Message Without Attachments Figure 7.8 represents a JAXM message without attachments. The model for the SOAP message without attachments is very similar to the SOAP message with attachments, except that there is no MIME envelope and no attachment part. |