Content starts here Create a Physical Data Service from an XML File
This page last changed on Mar 13, 2008.

eDocs Home > BEA AquaLogic Data Services Platform Documentation > Data Services Developer's Guide > Contents

How To Create a Physical Data Service from XML Data

XML files are a convenient means of handling hierarchical data. XML files and associated schemas are easily turned into library data service functions.

The following topics cover the actions necessary to create physical data services from XML data:

You can use the the physical data service creation wizard to:

  • Select XML Data as the Data Source type.
  • Select a schema file and option data file.
  • Create a Library data service based on the XML data.
Physical Data Service Creation Wizard

Setting Up the Physical Data Service Creation Wizard

Physical data services are created using a wizard.

Physical Data Service Creation Wizard

Starting the Wizard

To start the physical data service creation wizard:

  1. Right-click on your dataspace project or any folder in your project.
  2. Choose New > Physical Data Service
Creating a New Physical Data Service

Specifying XML Data Schema and File

A physical data service based on XML data requires identification of a valid XML schema and, optionally, a data source.

Import XML Data Wizard

The scheme must be available in your dataspace.

The data source can be:

  • File-based
  • URI-based 

In most cases the XML data will be available at runtime, through a URI.

However, in cases where the XML data is also in your project you can specify an absolute location for the file. You can also import data from any XML file on your system using an absolute path prepended with the following:

file:///

For example, on Windows systems you can access an XML file such as Orders.xml from the root C: directory using the following URI:

file:///c:/Orders.xml

On a UNIX system, you would access such a file with the following URI:

file:///home/Orders.xml

Setting Properties for New Library Functions

This general topic applies to setting properties for all types of library data service functions.

Use the Review New Data Service Operations page to:

  • Change the function name.
  • Set the Public option (check if you want your function to be available to client applications).
  • Set the kind of function (in some cases only one option will be available).
  • Set the Primary option (check if you want your function to be the primary of its type).
    In some cases this option may not be available.
  • Select a common XML namespace for the entire data service.
  • Set the target namespace.

The root element, which is read only, is also displayed.

Verifying Data Service Composition

On the Review New Data Service(s) page you can set, confirm or, optionally, change suggested data service names depending on the type of physical data service you are creating.

Default Physical Data Service Names 

The nominated name for a new data service is, wherever possible, the same as the source object name. In some cases, however, names are adjusted to conform with XML naming conventions.

XML Name Conversion Considerations

About Automatic Data Service Name Changes

Name conflicts occur when there is a data service of the same name present in the target directory. Name conflicts are highlighted in red.

There are several situations where you will need to change the name of your data service:

  • There already is a data service of the same name in your application.
  • You are trying to create multiple data services with the same name.

Data services always have the file extension:

.ds

XML File Import Sample

An XML file import sample can be found in the sample RTLApp directory:

DataServices/Demo

Testing the Import Wizard with an XML Data Source

When you create metadata for an XML data source but do not supply a data source name, you will need to identify the URI of your data source as a parameter when you execute the data service's read function.

The identification takes the form of:

<uri>/path/filename.xml

where uri is representative of a path or path alias, path represents the directory and filename.xml represents the filename. The .xml extension is required.

Document generated by Confluence on Apr 28, 2008 15:54