Chapter 3 Service Endpoint Design
107
E
It is important to consider the processing time for a request and whether the cli 
ent waits for the response. When a service expects an XML document as input 
and starts a lengthy business process based on the document contents, then cli 
ents typically do not want to wait for the response. Good design when process 
ing time may be extensive is to delegate a request to a JMS queue or topic and 
return a correlation identifier for the client's future reference. (Recall Figure 
3.7 on page 96 and its discussion.) 
The following sections discuss other considerations.
3.7.1 Exchanging XML Documents
As noted earlier, there are times when you may have to exchange XML documents
as part of your Web service and such documents are received as parameters of a
method call. The J2EE platform provides three ways to exchange XML documents. 
The first option is to use the Java MIME mappings provided by the J2EE plat 
form. See Table 3.1 on page 75. With this option, the Web service endpoint
receives documents as 
javax.xml.transform.Source
 objects. (See Code Example
3.3 on page 75.) Along with the document, the service endpoint can also expect to
receive other JAX RPC arguments containing metadata, processing requirements,
security information, and so forth. When an XML document is passed as a 
Source
object, the container automatically handles the document as an attachment 
effectively, the container implementation handles the document passing details
for you. This frees you from the intricacies of sending and retrieving documents
as part of the endpoint's request/response handling.
E
Passing XML documents as 
Source
 objects is the most effective option in a 
completely Java based environment (one in which all Web service clients are 
based on Java). However, sending documents as 
Source
 objects may not be in 
teroperable with non Java clients. (As already noted in the section  Interoper 
ability  on page 86, standard ways to exchange attachments are currently being 
formulated. Future versions of the J2EE platform will incorporate these stan 
dards once they are final.)
The second option is to design your service endpoint such that it receives doc 
uments as 
String
 types. Code Example 3.17 shows the WSDL description for a
service that receives documents as String types, illustrating how the WSDL maps
the XML document. 
<





New Page 1








Home : About Us : Network : Services : Support : FAQ : Control Panel : Order Online : Sitemap : Contact : Terms Of Service

 

Our web partners:  Jsp Web Hosting  Unlimited Web Hosting  Cheapest Web Hosting  Java Web Hosting  Web Templates  Best Web Templates  Web Design Templates  Interland Web Hosting  Cheap Web Hosting  Filemaker Web Hosting  Tomcat Web Hosting  Quality Web Hosting  Best Web Hosting  Mac Web Hosting

 
 

Virtualwebstudio. Business web hosting division of Vision Web Hosting Inc. All rights reserved

Web Hosting Apache