jaxb-api icon indicating copy to clipboard operation
jaxb-api copied to clipboard

JAXB doesn't support collection classes as top level objects

Open Tomas-Kraus opened this issue 18 years ago • 5 comments

JAXB 2.0 has no provision of handling any collection class as a top-level object. It can only handle them as properties of beans. To use jax-ws without the need for wrapper classes for collections, jaxb needs to support this.

Scenario: If you try to build a webservice with JAX-WS 2.0 and use a collection class in a service method directly, the generated schema is useless.

Example:

@WebService @SOAPBinding(style = Style.RPC) public class CollectionAsParamTestService { public void testCollections(ArrayList<String> stringList) {

} }

If I generate the wsdl and the corresponding schema with wsgen, the wsdl is generated with the following message fragment:

So far so good. Now the generated schema:

<xs:schema version="1.0" targetNamespace="http://impl.service.webservice.fss.portal.o2.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:complexType name="arrayList"> xs:complexContent <xs:extension base="ns1:abstractList" xmlns:ns1="http://impl.service.webservice.fss.portal.o2.com/"> xs:sequence/ </xs:extension> </xs:complexContent> </xs:complexType>

<xs:complexType name="abstractList" abstract="true"> xs:complexContent <xs:extension base="ns2:abstractCollection" xmlns:ns2="http://impl.service.webservice.fss.portal.o2.com/"> xs:sequence/ </xs:extension> </xs:complexContent> </xs:complexType>

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

So the xsd:string is missing inside the xs:sequence from the service call.

See also https://jax-ws.dev.java.net/issues/show_bug.cgi?id=28

Environment

Operating System: All Platform: All

Affected Versions

[2.0.2]

Tomas-Kraus avatar Aug 16 '06 02:08 Tomas-Kraus

  • Issue Imported From: https://github.com/javaee/jaxb-v2/issues/223
  • Original Issue Raised By:@glassfishrobot
  • Original Issue Assigned To: @glassfishrobot

Tomas-Kraus avatar Sep 21 '18 14:09 Tomas-Kraus

@glassfishrobot Commented Reported by [email protected]

Tomas-Kraus avatar Aug 16 '06 02:08 Tomas-Kraus

@glassfishrobot Commented kohsuke said: This is a spec issue.

Tomas-Kraus avatar Aug 16 '06 10:08 Tomas-Kraus

@glassfishrobot Commented Was assigned to snajper

Tomas-Kraus avatar Aug 16 '06 02:08 Tomas-Kraus

@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-223

Tomas-Kraus avatar Apr 24 '17 11:04 Tomas-Kraus