110
Handling XML Documents in a Web Service
"tns:PurchaseOrderService_submitPurchaseOrderResponse"/>
...
Code Example 3.19
Mapping XML document to 
xsd:anyType
A WSDL mapping of the XML document type to 
xsd:anyType
 requires the
platform to map the document parameter as a 
javax.xml.soap.SOAPElement
object. For example, Code Example 3.20 shows the Java interface generated for
the WSDL description in Code Example 3.19.
public interface PurchaseOrderService extends Remote {
public String submitPurchaseOrder(SOAPElement 
purchaseOrderXMLDoc) throws RemoteException;
}
Code Example 3.20
Java Interface for WSDL in Code Example 3.19
In this example, the 
SOAPElement
 parameter in 
submitPurchaseOrder
 repre 
sents the SOAP document fragment sent by the client. For the travel agency ser 
vice, this is the purchase order. The service can parse the received SOAP
document fragment using the 
javax.xml.soap.SOAPElement
 API. Or, the service
can use JAXB to map the document fragment to a Java 
Object
 or transform it to
another schema. A client of this Web service builds the purchase order document
using the client platform specific API for building SOAP document fragments 
on the Java platform, this is the 
javax.xml.soap.SOAPElement
 API and sends
the document as one of the Web service's call parameters.
When using the WSDL to Java approach, you can directly map the document
to be exchanged to its appropriate schema in the WSDL. The corresponding gen 
erated Java interface represents the document as its equivalent Java 
Object
. As a
result, the service endpoint never sees the document that is exchanged in its origi 
nal document form. It also means that the endpoint is tightly coupled to the docu 
ment's schema: Any change in the document's schema requires a corresponding
change to the endpoint. If you do not want such tight coupling, consider using
xsd:anyType
 to map the document. 






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

 

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