[Wsf-general] Data service handling of references

James Clark james at wso2.com
Mon Feb 26 23:31:02 PST 2007


I've been using a database with the following structure as an example to
think about the data service.

A customers table with the following columns:

- id (primary-key, numeric, auto-generated)
- name
- date of birth
- phone number
- country

A products table with the following columns:

- code (primary-key, alphanumeric, human-specified)
- description

An orders table with the following columns:

- id (primary-key, numeric, auto-generated)
- customer_id (references customers.id)
- status (enumeration)

An order_items table with the following columns:

- order_id (references orders.id)
- product_code (references products.code)
- quantity

Imagine I want an operation that gives me information about a particular
order based on its id. I would like to get back XML something like this.

<order>
  <id>12345</id>
  <customerId>678</customerId>
  <items>
    <item>
      <productCode>AA-123</productCode>
      <quantity>1</quantity>
    </item>
    <item>
      <productCode>BB-456</productCode>
      <quantity>1000</quantity>
    </item>
  </items>
</order>

In other words, I need to turn the references from the
order_items.order_id column to the orders.id column that are present in
the database into hierarchical relationships in the XML.

Most non-toy databases will have this sort of thing.  Microsoft have
done a lot of stuff in this area. See, e.g.

  http://msdn.microsoft.com/SQLXML

I think we've got to be able to handle this sort of thing.

James


    







More information about the Wsf-general mailing list