W3C home > Mailing lists > Public > www-ws-desc@w3.org > June 2003

Examples of substitution group extending WSDL.

From: Jonathan Marsh <jmarsh@microsoft.com>
Date: Wed, 18 Jun 2003 07:47:53 -0700
Message-ID: <1113DDB24D4A2841951BFDF86665EE1906A25B92@RED-MSG-10.redmond.corp.microsoft.com>
To: <www-ws-desc@w3.org>

Results of my tinkering below.

First, I created an instance with a brand new extension to see how a
fresh extension schema would work.
 
  <definitions xmlns="http://www.w3.org/@@@@/@@/wsdl"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:my="http://www.example.com/extensions/mine"
 
xsi:schemaLocation="http://www.example.com/extensions/mine extension.xsd
http://www.w3.org/@@@@/@@/wsdl wsdl.xsd"
               targetNamespace="http://example.com/jonathan/test">
    <documentation>This file tests validation of an extended WSDL
document</documentation>
    <my:extension>Jonathan Marsh</my:extension>
  </definitions>

I described this extension with a schema, and inserted it into the
globalExt substitution group (which allows the extension to appear at
the top level, and almost anywhere else, within WSDL).

  <xs:schema targetNamespace="http://www.example.com/extensions/mine"
             xmlns:wsdl="http://www.w3.org/@@@@/@@/wsdl"
             xmlns:xs="http://www.w3.org/2001/XMLSchema"
             elementFormDefault="qualified">
    <xs:import namespace="http://www.w3.org/@@@@/@@/wsdl"
               schemaLocation="wsdl.xsd"/>
    <xs:element name="extension" type="xs:string"
                substitutionGroup="wsdl:globalExt"/>
  </xs:schema>

Notes:
1) The extension schema imports the wsdl schema for the purpose of 
   allowing the substitution group to be specified.
2) The validator needs to associate both the extension schema and 
   the WSDL schema.  In this case I used the xsi:schemaLocation 
   mechanism.


Next I took an existing vocabulary (DSig) and tried to embed it in the
WSDL.

  <definitions xmlns="http://www.w3.org/@@@@/@@/wsdl"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
               xsi:schemaLocation="http://www.w3.org/2000/09/xmldsig#
wsdl+dsig.xsd http://www.w3.org/@@@@/@@/wsdl wsdl.xsd"
               targetNamespace="http://example.com/jonathan/test">
    <documentation>This file tests validation of an extended WSDL
document</documentation>
    <ds:Signature>
      <ds:SignedInfo>
        <ds:CanonicalizationMethod
Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
        <ds:SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1"/>
        <ds:Reference
URI="http://www.w3.org/TR/2000/REC-xhtml1-20000126/">
          <ds:Transforms>
            <ds:Transform
Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
          </ds:Transforms>
          <ds:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
          <ds:DigestValue>j6lwx3rvEPO0vKtMup4NbeVu8nk=</ds:DigestValue>
        </ds:Reference>
      </ds:SignedInfo>
      <ds:SignatureValue>MC0CFFrVLtRlk=...</ds:SignatureValue>
    </ds:Signature>
  </definitions>

In order to validate this, I had to modify the DSig schema
(wsdl+dsig.xsd) in three ways:
1) Add an appropriate substitutionGroup attribute, with the value of a
WSDL extension group QName.
2) Declare WSDL namespace prefix so the QName is valid.
3) Add an import of the wsdl schema so the QName reference is complete.

(new lines marked with "|")

  <schema targetNamespace="http://www.w3.org/2000/09/xmldsig#"
          ...>
|   <import namespace="http://www.w3.org/@@@@/@@/wsdl"
|           schemaLocation="wsdl.xsd"/>
    <element name="Signature" type="ds:SignatureType"
|            substitutionGroup="wsdl:globalExt"
|            xmlns:wsdl="http://www.w3.org/@@@@/@@/wsdl"/>
    ...
  </schema> 

Then I attempted the holy grail, a simple wrapper schema that would have
the effect of the schema above, while importing the DSig schema without
modification.  I failed in this because:
- Element declarations in an imported schema cannot be overridden.
- Redefine does not work on element declarations.
- There is no other way to add elements to a substitution group.

I rejected modifications to the instance document that would enable a
wrapper schema:
- Changing the namespace of the top level element.
- Introducing a wrapper element.

My conclusion is that the cleanest way to enable this scenario was
copying and modifying the DSig schema with the simple additions found
above.  I also note that this would be necessary to allow wsdl:required
attributes to appear on ds:Signature elements.

Do we find this limitation acceptable?  Does this limitation outweigh
the benefits of our substitution group extensibility mechanism?
Received on Wednesday, 18 June 2003 10:48:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:58:25 GMT