XML documents are a convenient means for handling hierarchical data. ALDSP enables the creation of data services that read data stored in XML files.
Objectives
After completing this lesson, you will be able to:
Import XML metadata and query XML files.
Confirm that the results conform to the XML file specifications.
Overview
Contents of an XML file can be turned into a data service and used as a data source.
In this lab you will create a data service that queries data stored in an XML file. The XML file contains UNSPSC product category received from third-party vendor.
33.1 Importing XML Metadata and XML Schema Definition
Importing XML metadata and schema definitions is similar to importing relational and Web service metadata, with some differences.
Objectives
In this lab, you will:
Import XML metadata.
Associate a schema and XML source file with the data service.
Generate a data service that reads XML data for the UNSPSC product category.
Instructions
Import the XMLFiles folder into the DataServices project. The folder is located in <beahome>\weblogic81\samples\LiquidData\EvalGuide.
Right click the XMLFiles folder and select Import Source Metadata.
Select XML Data from the Data Source Type drop-down list, then click Next.
Figure 33-1 Import XML Data
The Select XML Source window opens.
Figure 33-2 Select XML Source Window
Associate a schema file with the data service, by completing the following steps:
Click Browse, next to the Schema File field. The XMLFiles directory opens in the Select Schema Files window.
Expand the Schemas folder.
Select ProductUNSPSC.xsd and click Select.
Figure 33-3 Select Schema File
Associate the XML Document with the data service, by completing the following steps:
Click Browse, next to the XML Document field. The XMLFiles directory opens in the Select XML Source File window.
Select unspsc.xml and click Select.
Figure 33-4 Select XML Source File
The Select XML Source window is now populated with file information.
Figure 33-5 Populated Select XML Source Window
Click Next. The Summary window opens.
Figure 33-6 Summary Window
The Summary information includes the following details:
XML Type, for XML objects whose source metadata will be imported.
Name, for each data service that will be generated from the source metadata. (Any name conflicts appear in red; you can modify any data service name to correct an error condition or to change to a different project-unique name.)
Location, where the generated data service(s) will reside.
Click Finish. A new data service, called ProductUNSPSC.ds, is created in:
DataServices\XMLFiles
33.2 Testing the XML Data Service
After creating an XML data service, you need to confirm that the service is able to return data, based on the associated XML source file.
Objectives
In this lab, you will:
Build the DataService project.
Execute the productUNSPSC() function.
Compare the test results with the unspsc.xml file.
Instructions
Build the project containing the ProductUNSPSC data service.
Open ProductUNSPSC.ds in Test View.
Test the data service by completing the following steps:
Select productUNSPSC() from the Function drop-down list.
Click Execute.
Confirm that you can retrieve data, as displayed in Figure 33-7.
Figure 33-7 XML Data Service Test Results
4. In the Application pane expand the XMLFiles folder and open the unspsc.xml file.
Confirm that the test results conform to the specifications in the XML file.
Figure 33-8 XML Elements
Lesson Summary
In this lesson, you learned how to:
Access data in an XML file.
Confirm that the results conform to the contents of the XML file.