Section 14.8. What is XML schema?


14.8. What is XML schema?

XML data is structured. We can define what a complete purchase order looks like and then compare the documents we receive to that document. This is known as validation. One way to specify a document's structure is with the XML Schema Definition (XSD) language. XSD is an XML vocabulary used to articulate rules for business data. Example 14-1 shows the XML schema used in a web service that retrieves an address.

Example 14-1. An XML schema

 <xsd:schema    targetNamespace="http://sap.com/demo/WS/GetAddress/prepared"    xmlns="http://sap.com/demo/WS/GetAddress/prepared"    xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="Request_Message" type="Request"/> <xsd:element name="Response_Message" type="Response"/> <xsd:complexType name="Request"> <xsd:sequence> <xsd:element name="Employee_Id" type="xsd:string"/> <xsd:element name="Address_Type" type="xsd:string"/> <xsd:element name="Date" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="Response"> <xsd:sequence> <xsd:element name="First_Name" type="xsd:string"/> <xsd:element name="Last_Name" type="xsd:string"/> <xsd:element name="Care_of_Name" type="xsd:string"/> <xsd:element name="Street_Name" type="xsd:string"/> <xsd:element name="House_Number" type="xsd:string"/> <xsd:element name="Name_of_City" type="xsd:string"/> <xsd:element name="Zipcode" type="xsd:string"/> <xsd:element name="County" type="xsd:string"/> <xsd:element name="Country" type="xsd:string"/> <xsd:element name="Email_Address" type="xsd:string"/> <xsd:element name="Telephone_Number" type="xsd:string"/> <xsd:element name="Status" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema>

Based on this document, a program given the correct inputs can construct a valid XML message to call this functionality in an SAP system.




Enterprise SOA. Designing IT for Business Innovation
Enterprise SOA: Designing IT for Business Innovation
ISBN: 0596102380
EAN: 2147483647
Year: 2004
Pages: 265

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net