SOAP 1.2 Data Model Schema Language proposal

Author: Jacek Kopecky, Systinet, jacek@systinet.com

Date: 2004/2/17

Table of contents

  1. Introduction
  2. Motivation
  3. Example
  4. Language Overview
    1. Schema element
    2. Importing schemas
    3. Element declarations (named edge declarations)
    4. Structs
    5. Arrays
    6. Simple types
  5. Type definition name restrictions
  6. References

Introduction

This document describes a schema language for describing data structures that use the SOAP 1.2 Data Model. The language is modeled after the data-type modeling capabilities of languages like C.

Motivation

In WSDL 1.1, XML Schema was used for describing SOAP Data Model data. When the attribute use was set to encoded. The rules were as follows:

If use is encoded, then each message part references an abstract type using the type attribute. These abstract types are used to produce a concrete message by applying an encoding specified by the encodingStyle attribute. The part names, types and value of the namespace attribute are all inputs to the encoding, although the namespace attribute only applies to content not explicitly defined by the abstract types. If the referenced encoding style allows variations in its format (such as the SOAP encoding does), then all variations MUST be supported ("reader makes right").

The problem was that it wasn't specified anywhere how the encoding processes the provided XML Schema, and confusion and interoperability problems ensued.

WSDL 2 doesn't have the use attribute any more. Instead, it is envisioned that data models other than that of XML Schema will use their schema languages. This is such a language for the SOAP Data Model (and SOAP Encoding).

Example

<schema xmlns="http://jacek.cz/ns/soap-data-model-schema"
        targetNamespace="http://example.com/medical-records"
        xmlns:tns=      "http://example.com/medical-records"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">

   <element name="PatientInfo" type="tns:PatientInfo"/>
   
   <struct name="PatientInfo">
      <element name="Name" type="xs:string"/>
      <element name="Address" type="tns:Address"/>
      <element name="Records" type="tns:RecordArray"/>
   </struct>
   
   <struct name="Address">
      <element name="Street" type="xs:string"/>
      <element name="City" type="xs:string"/>
      <element name="ZIP" type="tns:ZIP"/>
      <element name="Country" type="xs:string" nillable="true"/>
   </struct>

   <array name="RecordArray" type="tns:Record" dimensions="1"/>

   <struct name="Record">
      <element name="RecordKind" type="xs:string"/>
      <element name="Date" type="xs:dateTime"/>
   </struct>

   <struct name="BloodTestRecord" extension="tns:Record">
      <element name="BloodTestResults" type="xs:string"/>
   </struct>

   <xs:simpleType name="tns:ZIP">
      <!-- an XML Schema simple type defn
      -->
   </xs:simpleType>
</schema>

Language overview

All the following elements are defined in the namespace http://jacek.cz/ns/soap-data-model-schema (ed: should be changed).

/schema (@targetNamespace)

The root element for a SOAP 1.2 Data Model Schema document. May contain any number of import elements; then any number of element, struct, array, xs:simpleType elements in any order.

The mandatory attribute targetNamespace sets the namespace name for all type and element names defined within this schema.

/schema/import (@namespace, @location?)

This element indicates that this schema may contain references to types or elements in the given namespace. The location attribute, when present, serves as a hint to the resolver as to where the definitions for that namespace may be found.

There may be multiple imports for the same namespace (presumably with different locations), there may even be imports for the same namespace as the targetNamespace of the containing schema (serving as include).

Note: the location attribute may point to both SOAP Data Model Schema Language instances and XML Schema instances, in the latter case only importing the top-level simple type defintions.

The namespace http://www.w3.org/2001/XMLSchema (containing XML Schema simple types) is imported automatically, there need not be an explicit import statement for this namespace.

element (@name, @type?, @nillable?)

Definition of a named edge. If used as a direct child of schema element (i.e. top-level), this named edge is inbound only. If used as a child of a struct or array element, the originating node of this edge is that defined by the parent struct or array element.

The name of the edge consists of the target namespace of the containing schema as the namespace name, and of the value of the mandatory name attribute as the local name. Edge names should be globally unique in the same sense as XML Schema element names (ed: no stoning please).

An element element must have either a non-empty value of the type attribute or precisely one type definition child. The value of the type attribute, if present, resolves to a top-level struct or array type definition or an XML Schema simple type with the given expanded name.

The type associated with this named edge defines the terminating node of this edge.

If the nillable attribute is present (only allowed when this element is a direct child of a struct or array element), and its value is true, the actual edge need not terminate in any node in instances of this schema.

element (@ref, @nillable)

Definition of a named edge. This form may only be used as a direct child of a struct or array element. The ref attribute resolves to a top-level named edge definition with the given expanded name. The edge name is this expanded name and the terminating graph node are the same as those of the referenced edge definition. The nillability of this edge is determined by the value of the nillable attribute, as above.

struct (@name?, @extension?)

Type definition of a struct graph node. If used as a direct child of a schema element (i.e. top-level), the attribute name is mandatory and its value defines the local part of the expanded name of this type. If used as a child of an element element, the attribute name is forbidden for it would have no meaning.

The name of the struct type, when present, consists of the target namespace of the containing schema as the namespace name, and of the value of the name attribute as the local name. See below for restrictions on type definition names.

The struct element contains zero or more element children, defining the (member) outbound edges leading from the defined node.

The optional extension attribute resolves to a top-level struct type definition, so-called extended type. The resulting type contains all the outbound edges (elements) defined by the extended type and the outbound edges defined by the element children of this struct. The extending type must not contain an outboud edge definition also contained by the extended type, i.e. struct member name conflicts are forbidden.

Note: struct extension is transitive, i.e. if struct B extends struct A and struct C extends struct B, struct C then also extends struct A and contains all its outbound edges (elements).

Circular extensions are forbidden, i.e. any struct A cannot extend a struct B that extends struct A, also struct A cannot extend itself.

array (@name?, @type?, @dimensions?)

Type definition of an array graph node. If used as a direct child of a schema element (i.e. top-level), the attribute name is mandatory and its value defines the local part of the expanded name of this type. If used as a child of an element element, the attribute name is forbidden for it would have no meaning.

The name of the array type, when present, consists of the target namespace of the containing schema as the namespace name, and of the value of the name attribute as the local name. See below for restrictions on type definition names.

An array element must have either a non-empty value of the type attribute or precisely one type definition child. The value of the type attribute, if present, resolves to a top-level struct or array type definition or an XML Schema simple type with the given expanded name.

The type of this array defines the type of the nodes to which all the outbound edges lead.

The dimensions attribute defines the dimensions of the array. The syntax is the same as for SOAP Encoding's arraySize attribute, defined as arraySizeValue in SOAP 1.2 Encoding. When missing, the dimensions of the array are "*".

xs:simpleType

Defines an XML Schema simple type as per XML Schema.

Type definition name restrictions

There is one common symbol space for all type definitions in SOAP Data Model Schema Language, i.e. all structs, arrays and XML Schema simple types share a symbol space and therefore their names must not clash. This restriction is the same as XML Schema's restriction on the names of complex types and simple types.

References