I'll tell you one thing right from the start - I'm surprised that Axis2 deals with a choice element with a maxOccurs on it. It used to be the case that Axis (or JAXB) would translate that into the Java equivalent of XmlElement. The first schema I created had a choice element like that, and I couldn't get Rational Web Developer to play nice with it.
I hope you're also aware of the potential ambiguity issues that can be caused by using a choice element. See
http://www.w3.org/TR/xmlschema-1/#cos-nonambigand
http://www.w3.org/TR/xmlschema-1/#non-ambig. These are what made me stop using choice - I don't want to have to think about things like that! They make my head hurt.
Also, having reviewed the WSDL, I have to say you'd do better if your import of urn:/animals had a schemaLocation. Here's what XMLSpy says about it:
The schema doesn't appear to be valid by itself (as a part of another schema, it might still be OK).
File ...schema2.xsd is not valid.
Unable to load schema with target namespace 'urn:/animals' from ''.
Error location: xs:schema / xs:import
Details
Unable to load schema with target namespace 'urn:/animals' from ''.
Finally, you've gotta be kidding me with this schema! Was this made up specifically to break code that interprets schemas? It's a nonsense schema. Microsoft would have to be fools to waste time making this work - it's full of things that are edge cases as best.
If you fix that schemaLocation problem, I bet you'll find that .NET handles those schemas perfectly well - as schemas. As far as translating them into code, it's a good think you don't need it, since it's not likely to ever work the way you'd like it to.
Schemas:
| <types> |
| <xs:schemaxmlns="urn:/animals"elementFormDefault="qualified"targetNamespace="urn:/animals"> |
| <xs:elementname="animal"> |
| <xs:complexType> |
| <xs:sequence> |
| <xs:elementminOccurs="0"maxOccurs="1"ref="fishes"/> |
| <xs:elementminOccurs="0"maxOccurs="1"ref="elephant"/> |
| <xs:elementminOccurs="0"maxOccurs="unbounded"ref="cat"/> |
| <xs:elementminOccurs="0"maxOccurs="unbounded"ref="dog"/> |
| <xs:choiceminOccurs="0"maxOccurs="unbounded"> |
| <xs:elementref="marmoset"/> |
| <xs:elementref="sloth"/> |
| </xs:choice> |
| </xs:sequence> |
| <xs:attributename="id"type="xs:string"/> |
| </xs:complexType> |
| </xs:element> |
| <xs:elementname="fishes"> |
| <xs:complexType> |
| <xs:choicemaxOccurs="unbounded"> |
| <xs:elementref="cod"/> |
| <xs:elementref="tuna"/> |
| </xs:choice> |
| </xs:complexType> |
| </xs:element> |
| <xs:complexTypename="cat"abstract="true"> |
| <xs:attributename="name"type="xs:string"/> |
| </xs:complexType> |
| <xs:elementabstract="true"name="cat"type="cat"/> |
| <xs:complexTypename="shorthair"> |
| <xs:complexContentmixed="false"> |
| <xs:extensionbase="cat"/> |
| </xs:complexContent> |
| </xs:complexType> |
| <xs:elementname="shorthair"substitutionGroup="cat"type="shorthair"/> |
| <xs:complexTypename="longhair"> |
| <xs:complexContentmixed="false"> |
| <xs:extensionbase="cat"/> |
| </xs:complexContent> |
| </xs:complexType> |
| <xs:elementname="longhair"substitutionGroup="cat"type="longhair"/> |
| <xs:elementname="cod"> |
| <xs:complexType> |
| <xs:attributename="cod"type="xs:string"/> |
| </xs:complexType> |
| </xs:element> |
| <xs:elementname="tuna"> |
| <xs:complexType> |
| <xs:attributename="tuna"type="xs:string"/> |
| </xs:complexType> |
| </xs:element> |
| <xs:complexTypename="dog"abstract="true"> |
| <xs:attributename="dog"type="xs:string"/> |
| </xs:complexType> |
| <xs:elementabstract="true"name="dog"type="dog"/> |
| <xs:complexTypename="pug"> |
| <xs:complexContentmixed="false"> |
| <xs:extensionbase="dog"/> |
| </xs:complexContent> |
| </xs:complexType> |
| <xs:elementname="pug"substitutionGroup="dog"type="pug"/> |
| <xs:complexTypename="collie"> |
| <xs:complexContentmixed="false"> |
| <xs:extensionbase="dog"/> |
| </xs:complexContent> |
| </xs:complexType> |
| <xs:elementname="collie"substitutionGroup="dog"type="collie"/> |
| <xs:elementname="elephant"> |
| <xs:complexType> |
| <xs:attributename="elephant"type="xs:string"/> |
| </xs:complexType> |
| </xs:element> |
| <xs:elementname="marmoset"> |
| <xs:complexType> |
| <xs:attributename="marmoset"type="xs:string"/> |
| </xs:complexType> |
| </xs:element> |
| <xs:elementname="sloth"> |
| <xs:complexType> |
| <xs:attributename="sloth"type="xs:string"/> |
| </xs:complexType> |
| </xs:element> |
| </xs:schema> |
| <xs:schemaxmlns="urn:/test/types"xmlns:animals="urn:/animals"elementFormDefault="qualified"targetNamespace="urn:/test/types"> |
| <xs:importnamespace="urn:/animals"/> |
| <xs:elementname="Simple"> |
| <xs:complexType> |
| <xs:sequence> |
| <xs:elementminOccurs="0"maxOccurs="1"ref="animals:animal"/> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| <xs:elementname="SimpleResponse"> |
| <xs:complexType/> |
| </xs:element> |
| </xs:schema> |
| </types> |
|
John Saunders | Use File->New Project to create Web Service Projects