Flylib.com

Books Software

 
 
 

Data-type Reuse


Data-type Reuse

To organize your Schemas in a way that benefits your company over time, store the reusable types in a set of Schema files that other Schemas can access. The types must be global. A Schema gains access to the reusable types by either of two declarations: include or import .

The include declaration is the preferred choice when the Schema being accessed either has no target namespace or has the same target namespace as the accessing Schema. The import declaration is necessary when the accessed Schema has a target namespace that differs from the target namespace of the accessing Schema.



Instance Document

The Schema described earlier validates the instance document shown in Listing 4.4.

Listing 4.4: Sample XML instance document

image from book
<?xml version="1.0" encoding="ISO-8859-1"?> <root:Insured xmlns:root="http://www.highlight.com/Insurance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://www.ibm.com/HighlightInsurance Insurance.xsd" CustomerID="5"> <CarPolicy PolicyType="Auto"> <Vehicle VIN="A123"> <Make>Honda</Make> <Model>Accord</Model> </Vehicle> <Vehicle VIN="A456"> <Make>Ford</Make> <Model>Mustang</Model> </Vehicle> </CarPolicy> <CarPolicy PolicyType="Antique Auto"> <Vehicle VIN="B321"> <Make>Triumph</Make> <Model>Spitfire</Model> </Vehicle> <Vehicle VIN="B654"> <Make>Buick</Make> <Model>Skylark</Model> </Vehicle> <Vehicle VIN="B987"> <Make>Porsche</Make> <Model>Speedster</Model> </Vehicle> </CarPolicy> </root:Insured>
image from book

We qualify Insured with the target namespace because that name is defined in a global element of the XML Schema. We cannot qualify the other names without causing a Schema validation error, because the Schema element elementFormDefault is set to unqualified .

After we declare a non-default namespace and use it to qualify Insured , we use the prefix xsi to specify an XML- related namespace and to set the attribute schemaLocation .

xsi:schemaLocation= "http://www.ibm.com/HighlightInsurance Insurance.xsd"

The setting of schemaLocation repeats the target namespace and tells the location of the XML Schema. The attribute setting is only a hint to the XML processor, which may be configured to use a different Schema.



Chapter 5: Established SOA Standards

Overview

In most cases, you use the following open -standard technologies when developing a Web service.

  • Web Services Description Language (WSDL) is an XML format for describing how to access a service.

  • SOAP is an XML format for transmitting data to and from a Web service. The runtime message includes business data (as defined in the WSDL definition) and may contain Quality-of-Service (QoS) details too, including (for example) the security details needed to gain access to the service. Although QoS details may be defined in the WSDL definition, those details are increasingly likely to be defined only when a system administrator uses an SOA runtime product to configure the message.

    SOAP was once called Simple Object Access Protocol and is now known only as SOAP.

  • Universal Description, Discovery, and Integration (UDDI) is a set of rules for registering and retrieving details about a business and its services. Some of the registered details are in the form of WSDL definitions.

WSDL and SOAP have become enormously important, with UDDI less so. The three standards are interrelated to some extent. Figure 5.1 depicts the relationship.

image from book
Figure 5.1: Established SOA standards

As the figure suggests, a WSDL definition describes a Web service. A UDDI-compliant service registry can help companies to discover that description. At run time, SOAP-based messages carry business data that conforms to the description.

The World Wide Web Consortium (W3C) is the sponsoring organization for WSDL and SOAP. The Organization for the Advancement of Structured Information Standards (OASIS) has an equivalent role for UDDI.