Chapter 3 Service Endpoint Design
75
clarity, it is preferable to use this feature and embed value type references rath
er than to use a single flat, large JAX RPC value type class.
4. The J2EE platform, because of its support for the SOAP message with attach
ment protocol, also supports the use of MIME encoded content. It provides
Java mappings for a subset of MIME types. (See Table 3.1.)
Table 3.1
Mapping of MIME Types
MIME Type
Java Type
image/gif
java.awt.Image
image/jpeg
java.awt.Image
text/plain
java.lang.String
multipart/*
javax.mail.internet.MimeMultipart
text/xml
or
application/xml
javax.xml.transform.Source
Since the J2EE container automatically handles mappings based on the Java
types, using these Java MIME mappings frees you from the intricacies of sending
and retrieving documents and images as part of a service's request and response
handling. For example, your service, if it expects to receive a GIF image with a
MIME type of
image/gif
, can expect the client to send a
java.awt.Image
object.
A sample Web service interface that receives an image might look like the one
shown in Code Example 3.3:
import java.awt.Image;
public interface WeatherMapService extends Remote {
public void submitWeatherMap(Image weatherMap)
throws RemoteException, InvalidMapException;
}
Code Example 3.3
Receiving a
java.awt.Image
Object
In this example, the
Image
object lets the container implementation handle the
image passing details. The container provides
javax.activation.DataHandler
classes, which work with the Java Activation Framework to accomplish the Java
MIME and MIME Java mappings.
footer
Our web partners:
Inexpensive
Web Hosting
Java Web Hosting
personal webspace
webspace php
linux webhost
html web templates
DreamweaverQuality Web Templates
PSD Web Templates
cheap webhost
j2ee web Hosting
buy webspace
ftp webspace
adult webspace
frontpage WebHosting
webspace hosting
cheap webhost
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved
webhosting