W3C home > Mailing lists > Public > www-ws-desc@w3.org > March 2005

Problem with Service References: elementFormDefault="qualified" prevents restriction

From: Arthur Ryman <ryman@ca.ibm.com>
Date: Mon, 28 Mar 2005 16:42:24 -0500
To: www-ws-desc@w3.org
Message-ID: <OFED768ADA.5136FCC4-ON85256FD2.00740D8D-85256FD2.00773B5B@ca.ibm.com>
In the process of writing the Primer section on Service References, I have 
found a problem in the solution we adopted. The context of this topic is 
that some services may reference to other services, and we were defining a 
way that WSDL could be used to describe the interface and binding of the 
service that was being refered to.

Recall that the we decided to go with Roberto's counter-proposal [1] which 
was based on the idea of using XSD to restrict wsdl:ServiceType and 
wsdl:Endpoint to have fixed values for @interface and @binding, and to 
transmit service references using the restricted wsd:ServiceType.

If you just want to say that a message contains a reference to another 
service and you don't want to contrains the interface or binding, then you 
directly re-use the wsdl:ServiceType in the message.

If you want to describe the interface of the service, then you create a 
new type that restricts the value of the @interface attribute to have a 
fixed value which is the QName of the interface. This works, e.g. 

If you also want to describe the binding of the service, then you create a 
new type that restricts the value of the @binding attribute of 
wsdl:EndpointType. You can do that, but there is no way you can actually 
use this type to restrict the <wsdl:endpoint> element. Here is a sample.

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
        elementFormDefault="qualified"
        targetNamespace=
"http://greath.example.com/2004/schemas/reservationDetails"
        xmlns:tns=
"http://greath.example.com/2004/schemas/reservationDetails"
        xmlns:wdetails=
"http://greath.example.com/2004/services/reservationDetails"
        xmlns:wsdl="http://www.w3.org/2004/08/wsdl">

        <import namespace="http://www.w3.org/2004/08/wsdl"
                schemaLocation="wsdl20-1.xsd" />


        <complexType name="ReservationDetailsEndpointType">
                <complexContent>
                        <restriction base="wsdl:EndpointType">
                                <attribute name="binding" type="QName" use
="required"
                                        fixed=
"wdetails:reservationDetailsSOAPBinding" />
                        </restriction>
                </complexContent>
        </complexType>

        <complexType name="ReservationDetailsServiceType">
                <complexContent>
                        <restriction base="wsdl:ServiceType">
                                <sequence>
                                        <element name="endpoint"
                                                type=
"tns:ReservationDetailsEndpointType" />
                                </sequence>
                                <attribute name="interface" type="QName" 
use="required"
                                        fixed=
"wdetails:reservationDetailsInterface" />
                        </restriction>
                </complexContent>
        </complexType>
</schema>

The problem is that within the <restriction> of wsdl:ServiceType, the 
<element name="endpoint" ...> refers the QName tns:endpoint, not 
wsdl:endpoint because we use elementFormDefault="qualified". This is 
actually a valid restriction since the content model of wsdl:ServiceType 
allows elements from other namespaces. However, this does not restrict the 
wsdl:endpoint element to have the fixed binding value. FYI, here is a 
chunk of a valid instance document according to this restricted service 
type.

        <reservation>
                <details:confirmationNumber>HSG635</
details:confirmationNumber>
                <details:checkInDate>2005-06-27</details:checkInDate>
                <details:checkOutDate>2005-06-28</details:checkOutDate>
                <details:reservationDetailsService
                        interface="wdetails:reservationDetailsInterface">
                        <details:endpoint name="SOAP"
                                binding=
"wdetails:reservationDetailsSOAPBinding"
                                address=
"http://greath.example.com/2004/reservation/HSG635"/>
                </details:reservationDetailsService>
        </reservation>

There is a fix however. The reason that we were able to restrict the 
attribute values is that they are unqualified. Therefore, if we changed 
our WSDL schema to use elementFormDefault="unqualified", and we ensured 
that <endpoint> was a local element, then we could restrict it. However, 
for consistency, we should probably also make the other nested elements 
unqualified, i.e. just keep the top-level elements (<interface>, 
<binding>, <service>, etc.) qualified. We can still have named complex 
types for all the elements though.

Arthur Ryman,
Rational Desktop Tools Development

phone: +1-905-413-3077, TL 969-3077
assistant: +1-905-413-2411, TL 969-2411
fax: +1-905-413-4920, TL 969-4920
mobile: +1-416-939-5063, text: 4169395063@fido.ca
intranet: http://labweb.torolab.ibm.com/DRY6/
Received on Monday, 28 March 2005 21:42:56 GMT

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