开发者

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

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:complexConten开发者_开发百科t>
</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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜