Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Page 2 of 6
While SOAP's design center focuses on encapsulating XML documents in a message, SOAP's attachment feature extends a SOAP message to include, in addition to the regular SOAP part, zero or more attachments, as Figure 1 shows. Each attachment is defined by a MIME type and can assume any content represented as a byte stream.
Figure 1. A SOAP message with attachments
SOAP's attachment feature proves most useful when a client wishes to transmit binary data, such as an image or audio data, to a Web service. Without SOAP attachments, sending a piece of binary data would prove more difficult. For instance, a client's SOAP message could convey the binary file's URL address. The client would then have to operate an HTTP server to let the Web service retrieve that file. That would represent an undue burden on any Web service client, especially on clients running on limited-resource devices such as digital cameras or scanners. SOAP's attachment capability lets any Web service client able to transmit SOAP messages embed binary files directly in a SOAP message.
SOAP attachments, for instance, prove handy when interacting with portal Websites. Consider a real estate agency network that needs to distribute descriptions and photographs of homes for sale to a centralized real estate search portal. If the portal operates a servlet allowing the posting of SOAP messages with attachments, a real estate agency could update its listings with a few SOAP messages, including photos of those homes. The SOAP message body might embed the property description, and SOAP attachments could carry the image files. Under that scenario, when a portal operator's servlet receives such a message, it would return an acknowledgment document, indicating the post's availability on the portal. Figure 2 illustrates such a Web service.
Figure 2. A real estate Web service, using SOAP with attachments
The SOAP Messages with Attachments W3C (World Wide Web Consortium) Note (see Resources) does not add new features to SOAP. Rather, it defines how to take advantage of MIME types in a SOAP message to define attachments, and how to reference those attachments from within the SOAP body.
The MIME type
multipart/related defines documents consisting of multiple related parts. SOAP messages with attachments must follow the
multipart/related MIME type. The example below shows a
multipart/related SOAP message, bound to the HTTP protocol, with two attachments:
POST /propertyListing HTTP/1.1 Host: www.realproperties.com Content-Type: Multipart/Related; boundary=MIME_boundary; type=text/xml; start="<email@example.com>" Content-Length: NNNN --MIME_boundary Content-Type: text/xml; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-ID: <firstname.lastname@example.org> <?xml version='1.0'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <realProperty:propertyListing id="property_432" xmlns:realProperty="http://schemas.realhouses.com/listingSubmission"> <listingAgency>Really Nice Homes, Inc.</listingAgency> <listingType>Add</listingType> <propertyAddress> <street>1234 Main St</street> <city>Pleasantville</city> <state>CA</state> <zip>94323</zip> </propertyAddress> <listPrice> 250000 </listPrice> <frontImage href="email@example.com"/> <interiorImage href="firstname.lastname@example.org"/> </realProperty:propertyListing> </SOAP-ENV: Body> </SOAP-ENV: Envelope> --MIME_boundary Content-Type: image/jpeg Content-ID: <email@example.com> ....JPEG DATA ..... --MIME_boundary Content-Type: image/jpeg Content-ID: <firstname.lastname@example.org> ....JPEG DATA ..... --MIME_boundary--
The above multipart message comprises a series of MIME-headers and related data. At the root of the document is the SOAP body.
Because the SOAP body contains only XML data, the MIME type of the entire message is
text/xml. Following the SOAP envelope are two attachments, each corresponding to an image file sent along with the message.
|Forum migration complete By Athen|
|Forum migration update By Athen|
|Problems using SAAJ from a java 1.4 Standalone By|
|Back to business By mr hitec|
|sending file as soap attachment using axis By|
|Base64 Encoding By Krishna Balwalli|