Re: Circular schema?

Hi Brenda,

> I'm starting to run across WSDL schemas generated by .NET (sometimes
> I just want to shoot them:) that appear to have a circular
> structure... basically, the schema defines all the applicable types
> just fine... but it also defines a type that's referenced by the
> message part that looks like this:
>
>       <s:element name="GetResponse">
>         <s:complexType>
>           <s:sequence>
>             <s:element minOccurs="0" maxOccurs="1" name="GetResult">
>               <s:complexType>
>                 <s:sequence>
>                   <s:element ref="s:schema"/>
>                   <s:any/>
>                 </s:sequence>
>               </s:complexType>
>             </s:element>
>           </s:sequence>
>         </s:complexType>
>       </s:element>
>
> First, it has always been my understanding that an element ref has
> to reference a global element. Is the entire schema considered a
> global element?

I think that you're confusing two levels here. First, there's the
schema that you're looking at, which is a schema for WSDL. Second,
there are the WSDL instance documents. Now, it happens that WSDL
instance documents can contain a GetResult element that contains a
schema. The schema embedded in the WSDL instance document is an XML
Schema document, and has xs:schema as its enclosing element.

What you're seeing in the WSDL schema, then, is the GetResult element
declaration saying that the GetResult element in the WSDL instance can
hold an element called s:schema (where 's' resolves to the XML Schema
namespace). The "s:schema" isn't referring to the document element of
the WSDL schema; it's just another element. Interpret it as you would
if it was:

  <s:element minOccurs="0" maxOccurs="1" name="GetResult">
    <s:complexType>
      <s:sequence>
        <s:element ref="foo:bar"/>
        <s:any/>
      </s:sequence>
    </s:complexType>
  </s:element>

You should find that somewhere in the WSDL schema is an import for the
XML Schema namespace; that probably points to the schema for XML
Schema, which will contain an element declaration for the s:schema
element.

Does that make sense?

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Saturday, 27 July 2002 10:48:09 UTC