RE: ISSUE-2: WSDL and the Test Suite

ISSUE-2: WSDL and the Test Suite.
 
Strawman Template
 
On the calls we have been discussing how we are going to catalogue test cases and how we are going to represent these for inclusion in the test suite. It is suggested that we have some standard for submitting schema examples for inclusion in the basic or advanced pattern suites. 
 
This would be ideal although we do not want to discourage contributors who are not prepared to re-work schemas in order submit test cases in a specific format. The following examples therefore describe how we could catalogue submitted tests and publish wsdl for them. Contributors should of course be encouraged to submit tests in whichever format we decide to catalogue them.
 
The following schema takes the enumeration fragment from the WG input document [1]
 
<xs:schema targetNamespace=http://www.w3.org/2002/ws/databinding/testsuite/example/1

  elementFormDefault="qualified" attributeFormDefault="unqualified"> 
<xs:simpleType name='Beatle' >
  <xs:restriction base='xs:string' >
   <xs:enumeration value='John' />
   <xs:enumeration value='Paul />
   <xs:enumeration value='George' />
   <xs:enumeration value='Stuart' />
   <xs:enumeration value='Pete' />
   <xs:enumeration value='Ringo' />
  </xs:restriction>
</xs:simpleType>
<xs:element name=’echo’ type=’Beatle’ />
</xs:schema>
 
Note
1.      That the namespace supplied is for the workgroups own testsuite and identifies a particular test/example.
2.      The global element ’echo’ is a standard name that allows us to autogenerate wsdl for this.
 
 
This could be used to generate a wsdl automatically such as
 
 
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:example="http://www.w3.org/2002/ws/databinding/testsuite/example/1" xmlns:tns="http://www.w3.org/2002/ws/databinding/testsuite/example/1/wsdl" targetNamespace="http://www.w3.org/2002/ws/databinding/testsuite/example/1/wsdl" >
<types>
<xs:schema targetNamespace="http://www.w3.org/2002/ws/databinding/testsuite/example/1" xmlns:example1="http://www.w3.org/2002/ws/databinding/testsuite/example/1"  elementFormDefault="qualified" attributeFormDefault="unqualified">
                                    <xs:simpleType name="Beatle">
                                                <xs:restriction base="xs:string">
                                                            <xs:enumeration value="John"/>
                                                            <xs:enumeration value="Paul"/>
                                                            <xs:enumeration value="George"/>
                                                            <xs:enumeration value="Stuart"/>
                                                            <xs:enumeration value="Pete"/>
                                                            <xs:enumeration value="Ringo"/>
                                                </xs:restriction>
                                    </xs:simpleType>
                                    <xs:element name="echo" type="example1:Beatle"/>
               </xs:schema>
            </types>
            <message name="example1EchoInput">
                        <part name="example1Input" element="example1:echo"/>
            </message>
            <message name="example1EchoOutput">
                        <part name="example1Output" element="example1:echo"/>
            </message>
            <portType name="Example1PortType">
                        <operation name="echo">
                                    <input message="tns:example1EchoInput"/>
                                    <output message="tns:example1EchoOutput"/>
                        </operation>
            </portType>
            <binding name="Example1Binding" type="tns:Example1PortType">
            <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
                        <operation name="echo">
                        <soap:operation soapAction="http://localhost:8080/soap/servlet/TestSuite#Example1" style="document"/>
                                    <input>
                                                <soap:body use="literal"/>
                                    </input>
                                    <output>
                                                <soap:body use="literal"/>
                                    </output>
                        </operation>
            </binding>
            <service name="Example1">
                        <port name="Example1Port" binding="tns:Example1Binding">
                                    <soap:address location="http://localhost:8080/soap/servlet/Example1"/>
                        </port>
            </service>
</definitions>
 

 
Note

The wsdl NS above is related to the schema NS however this is not important and we may wish to have multiple examples published in the one wsdl which would remove this correlation 
The standard way of referring into the schema via the global element ‘echo’ in the types section uniquely identified by the example specific namespace. 
The automated naming of Service, Port, Binding, Messages, Parts and PortTypes based on the example identification. 
The generic operation name ‘echo’
 

 
The endgame here is to produce clean unproblematic wsdl that can be used to implement a service in various technologies/toolkits. The wsdl will also be used to generate a test client that will call the services and validate that a particular service instance behaves as it should do when called i.e. accurately echoing back the message structures/data.
 
It is important that the test cases be composable. We may wish to publish individual wsdls per test case as above or publish one wsdl that describes a group of associated testcases.  E.g.
 
 
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:example1="http://www.w3.org/2002/ws/databinding/testsuite/example/1" xmlns:example2="http://www.w3.org/2002/ws/databinding/testsuite/example/2" xmlns:tns="http://www.w3.org/2002/ws/databinding/testsuite/example/1/wsdl" targetNamespace="http://www.w3.org/2002/ws/databinding/testsuite/example/1/wsdl" >
<types>
<xs:schema targetNamespace="http://www.w3.org/2002/ws/databinding/testsuite/example/1" xmlns:example1="http://www.w3.org/2002/ws/databinding/testsuite/example/1"  elementFormDefault="qualified" attributeFormDefault="unqualified">
                                                <xs:simpleType name="Beatle">
                                                                <xs:restriction base="xs:string">
                                                                                <xs:enumeration value="John"/>
                                                                                <xs:enumeration value="Paul"/>
                                                                                <xs:enumeration value="George"/>
                                                                                <xs:enumeration value="Stuart"/>
                                                                                <xs:enumeration value="Pete"/>
                                                                                <xs:enumeration value="Ringo"/>
                                                                </xs:restriction>
                                                </xs:simpleType>
                                                <xs:element name="echo" type="example1:Beatle"/>
</xs:schema>
<xs:schema targetNamespace="http://www.w3.org/2002/ws/databinding/testsuite/example/2" xmlns:example2="http://www.w3.org/2002/ws/databinding/testsuite/example/2"  elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:simpleType name='KnownCurrency' >
 <xs:restriction base='xs:string' >
  <xs:enumeration value='GBP' />
  <xs:enumeration value='USD' />
  <xs:enumeration value='CAD' />
 </xs:restriction>
</xs:simpleType>
<xs:simpleType name='Currency' >
 <xs:union memberTypes='example2:KnownCurrency xs:string' />
</xs:simpleType>
<xs:element name="echo" type="example2:Currency"/>
</xs:schema>
 
</types>
                <message name="example1EchoInput">
                                <part name="example1Input" element="example1:echo"/>
                </message>
                <message name="example1EchoOutput">
                                <part name="example1Output" element="example1:echo"/>
                </message>
                <message name="example2EchoInput">
                                <part name="example2Input" element="example2:echo"/>
                </message>
                <message name="example2EchoOutput">
                                <part name="example2Output" element="example2:echo"/>
                </message>
 
                <portType name="ExamplePortType">
                                <operation name="echoExample1">
                                                <input message="tns:example1EchoInput"/>
                                                <output message="tns:example1EchoOutput"/>
                                </operation>
                                <operation name="echoExample2">
                                                <input message="tns:example2EchoInput"/>
                                                <output message="tns:example2EchoOutput"/>
                                </operation>
 
                </portType>
                <binding name="ExampleBinding" type="tns:ExamplePortType">
                <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
                                <operation name="echoExample1">
                                <soap:operation soapAction="http://localhost:8080/soap/servlet/TestSuite#Example1" style="document"/>
                                                <input>
                                                                <soap:body use="literal"/>
                                                </input>
                                                <output>
                                                                <soap:body use="literal"/>
                                                </output>
                                </operation>
                                <operation name="echoExample2">
                                <soap:operation soapAction="http://localhost:8080/soap/servlet/TestSuite#Example2" style="document"/>
                                                <input>
                                                                <soap:body use="literal"/>
                                                </input>
                                                <output>
                                                                <soap:body use="literal"/>
                                                </output>
                                </operation>
 
                </binding>
                <service name="Example">
                                <port name="ExamplePort" binding="tns:ExampleBinding">
                                                <soap:address location="http://localhost:8080/soap/servlet/Example"/>
                                </port>
                </service>
</definitions>
 
 
 
In this example we have included the more advanced test case for ‘open’ enumerations described in [1]. The above wsdl defines a single service with multiple operations corresponding to the specific testcases. The test cases were represented as distinct schemas in the types section. It would also have been possible to represent the two test cases in a single schema with different entry points but this does sacrifice a degree of simplicity in the creatiion of the wsdl.
 
 
 
References
[1] XML Schema Patterns for Common Data Structures. Paul Downey. http://www.w3.org/2005/07/xml-schema-patterns.html

 

  

Received on Tuesday, 10 January 2006 10:37:46 UTC