1

「ボトムアップ」の JAX-WS をいじっていて、wsgen を実行しているときに奇妙なことに遭遇しました。

次のようなサービス クラスがあるとします。

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

wsgen を実行すると、次のような FooService_schema1.xsd が得られます。

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

これは合理的と思われます。

ただし、次のようなコレクションのコレクションが必要な場合:

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

生成されたスキーマは次のようなものになります。

<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>

空のシーケンスは、私が考えていたものではありません

私の最初のアプローチは、次のようにすることでした:

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

しかし、それは最後にも空のシーケンスで終わるだけの複雑なタイプの大きなチェーンで終わります:

<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>

何か足りないのでしょうか、それとも wsgen の既知の穴ですか? JAXB?

アンディ

4

0 に答える 0