JAX-WS wsgen and collections of collections: wsgen broken?

1k views Asked by At

I've been playing around with "bottom-up" JAX-WS and have come across something odd when running wsgen.

If I have a service class that does something like:

@WebService
public class Foo {
public ArrayList<Bar> getBarList(String baz) { ... }
}

then running wsgen gets me a FooService_schema1.xsd that has something like this:

<xs:complexType name="getBarListResponse">
<xs:sequence>
<xs:element name="return" type="tns:bar" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

which seems reasonable.

However, if I want a collection of collections like:

public BarCollection getBarCollection(String baz) { ... }  // BarCollection is just a container for an ArrayList<Bar>

then the generated schema ends up with stuff like:

<xs:complexType name="barCollection">
  <xs:sequence/>
</xs:complexType>

<xs:complexType name="getBookCollectionsResponse">
<xs:sequence>
<xs:element name="return" type="tns:barCollection" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

An empty sequence is not what I had in mind at all.

My original approach was to go with:

public ArrayList<ArrayList<Bar>> getBarLists(String baz) { ... }

but that ends up with a big chain of complexTypes that just wind up with an empty sequence at the end as well:

<xs:complexType name="getBarListsResponse">
<xs:sequence>
<xs:element name="return" type="tns:arrayList" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="arrayList">
<xs:complexContent>
<xs:extension base="tns:abstractList">
<xs:sequence/>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="abstractList" abstract="true">
<xs:complexContent>
<xs:extension base="tns:abstractCollection">
<xs:sequence/>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="abstractCollection" abstract="true">
<xs:sequence/>
</xs:complexType>

Am I missing something or is this a known hole in wsgen? JAXB?

Andy

0

There are 0 answers