Jeff's right. The .NET error is valid, and Axis is just being nice.
So to elaborate, a proper definition would be:

(using anonomous type definitions -- you can't refer to the anonomous types)
<xsd:element name="services">
  <xsd:complexType>
    <xsd:sequence>
       <xsd:element name="service" minOccurs="0"
                maxOccurs="unbounded">
          <xsd:complexType>
             <xsd:sequence>
                 <xsd:element name="name" type="xsd:string"
                   minOccurs="1" maxOccurs="1" />
                 <xsd:element name="description" type="xsd:string"
                   minOccurs="0" maxOccurs="1" />
                 <xsd:element name="wsdlURL" type="xsd:string"
                   minOccurs="1" maxOccurs="1" />
             </xsd:sequence>
          </xsd:complexType>
       </xsd:element>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>

or

(using global type definitions -- you can refer to these types)
<xsd:element name="services" type="tns:servicesClass" />
<xsd:complexType name="servicesClass">
  <xsd:sequence>
   <xsd:element name="service" type="serviceClass"
       minOccurs="0" maxOccurs="unbounded">
   </xsd:element>
  </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="serviceClass">
  <xsd:sequence>
    <xsd:element name="name" type="xsd:string"
                   minOccurs="1" maxOccurs="1" />
    <xsd:element name="description" type="xsd:string"
                   minOccurs="0" maxOccurs="1" />
    <xsd:element name="wsdlURL" type="xsd:string"
                   minOccurs="1" maxOccurs="1" />
  </xsd:sequence>
</xsd:complexType>


----- Original Message -----
From: "Jeff Greif" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 07, 2003 2:54 PM
Subject: Re: MS and named types


> I suspect that .Net has a schema processor that is objecting to the names
> you give your inline type definitions.  I think to use named types, you'd
> have to break them out as global complex or simple Types (that is,
children
> of the <schema> element), and use the type= attribute on the element
> declaration.  The XML Schema spec says (section 3.3.2):
>
>  <element>s within <schema> produce global element declarations;
<element>s
> within <group> or <complexType> produce either particles which contain
> global element declarations (if there's a ref attribute) or local
> declarations (otherwise). For complete declarations, top-level or local,
the
> type attribute is used when the declaration can use a built-in or
> pre-declared type definition. Otherwise an anonymous <simpleType> or
> <complexType> is provided inline.
>
> Jeff
> ----- Original Message -----
> From: "Charles Simon" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, August 07, 2003 11:27 AM
> Subject: MS and named types
>
>
> > I have been using Axis 1.0 for quite a while and my WSDL documents
> > contain complexType and simpleType declarations that are named.  Not a
> > problem so far. (NOTE: The WSDL is not generated by Axis.)  I just
> > started using Visual Studio .NET to build C# equivalents to my Java test
> > programs that act as Web service clients.  I ran into some problems with
> > my WSDL documents.
> >
> > The body of the SOAP response message is strictly hierarchical and it
> > seemed reasonable to declare the complexType for a given element as part
> > of the element definition .  Example:
> >
> > <xsd:element name="services">
> >  <xsd:complexType name="servicesClass">
> >   <xsd:sequence>
> >    <xsd:element name="service" minOccurs="0"
> >                 maxOccurs="unbounded">
> >     <xsd:complexType name="serviceClass">
> >      <xsd:sequence>
> >       <xsd:element name="name" type="xsd:string"
> >                    minOccurs="1" maxOccurs="1" />
> >       <xsd:element name="description" type="xsd:string"
> >                    minOccurs="0" maxOccurs="1" />
> >       <xsd:element name="wsdlURL" type="xsd:string"
> >                    minOccurs="1" maxOccurs="1" />
> >      </xsd:sequence>
> >     </xsd:complexType>
> >    </xsd:element>
> >   </xsd:sequence>
> >  </xsd:complexType>
> > </xsd:element>
> >  --- end Example ------------------------------------
> >
> > Axis WSDL2Java tool does not have a problem with this and uses the
> > "name" of the complexType as the class name in the generated Java code.
> > All is well,
> >
> > But, the Microsoft tool complains that each complexType has a name
> > attribute and should not.  It then complains that it can't find the
> > corresponding elements when they are used later on in the WSDL document.
> >
> > Is this a valid error message?  If so, why does Axis think this is
> > alright?  Is it just being nice?
> >
> >
> >
>

Reply via email to