Chapter 3 Service Endpoint Design
There may be a performance drawback to sending an XML document as a
object: As the document size grows, the
equivalent size of the
document grows as well. As a result, the payload size of the message you send
also grows. In addition, the XML document loses its original format since
sending a document as a
object sends it in a canonical format.
The third option is to exchange the XML document as a SOAP document
fragment. With this option, you map the XML document to
service's WSDL file.
It is recommended that Web services exchange XML documents as SOAP doc
ument fragments because passing XML documents in this manner is both por
table across J2EE implementations and interoperable with all platforms.
To pass SOAP document fragments, you must implement your service using
the WSDL to Java approach.
For example, the travel agency service receives an XML document represent
ing a purchase order that contains all details about the customer's preferred travel
plans. To implement this service, you define the WSDL for the service and, in the
WSDL, you map the XML document type as
. See Code Example