Samples Tutorial

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Creating Data Services from XML Files

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:

 


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:

Instructions

  1. Import the XMLFiles folder into the DataServices project. The folder is located in <beahome>\weblogic81\samples\LiquidData\EvalGuide.
  2. Right click the XMLFiles folder and select Import Source Metadata.
  3. Select XML Data from the Data Source Type drop-down list, then click Next.
  4. Figure 33-1 Import XML Data


    Import XML Data

    The Select XML Source window opens.

    Figure 33-2 Select XML Source Window


    Select XML Source Window

  5. Associate a schema file with the data service, by completing the following steps:
    1. Click Browse, next to the Schema File field. The XMLFiles directory opens in the Select Schema Files window.
    2. Expand the Schemas folder.
    3. Select ProductUNSPSC.xsd and click Select.
    4. Figure 33-3 Select Schema File


      Select Schema File

  6. Associate the XML Document with the data service, by completing the following steps:
    1. Click Browse, next to the XML Document field. The XMLFiles directory opens in the Select XML Source File window.
    2. Select unspsc.xml and click Select.
    3. Figure 33-4 Select XML Source File


      Select XML Source File

      The Select XML Source window is now populated with file information.

      Figure 33-5 Populated Select XML Source Window
  7. Click Next. The Summary window opens.
  8. Figure 33-6 Summary Window


     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.
  9. Click Finish. A new data service, called ProductUNSPSC.ds, is created in:
  10. 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:

Instructions

  1. Build the project containing the ProductUNSPSC data service.
  2. Open ProductUNSPSC.ds in Test View.
  3. Test the data service by completing the following steps:
    1. Select productUNSPSC() from the Function drop-down list.
    2. Click Execute.
    3. Confirm that you can retrieve data, as displayed in Figure 33-7.
    4. Figure 33-7 XML Data Service Test Results


      XML Data Service Test Results

  4. 4. In the Application pane expand the XMLFiles folder and open the unspsc.xml file.
  5. Confirm that the test results conform to the specifications in the XML file.
  6. Figure 33-8 XML Elements


    XML Elements

 


Lesson Summary

In this lesson, you learned how to:


  Back to Top       Previous  Next