Chapter 3 Service Endpoint Design
109
E
There may be a performance drawback to sending an XML document as a
String
object: As the document size grows, the
String
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
String
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
xsd:anyType
in the
service's WSDL file.
E
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.
E
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
xsd:anyType
. See Code Example
3.19.
name="PurchaseOrderService_submitPurchaseOrderResponse">
parameterOrder="PurchaseOrderXMLDoc">
message="tns:PurchaseOrderService_submitPurchaseOrder"/>
<
New Page 1
Web Hosting Apache