jaxb-api
jaxb-api copied to clipboard
JAXB doesn't support collection classes as top level objects
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]
- Issue Imported From: https://github.com/javaee/jaxb-v2/issues/223
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: @glassfishrobot
@glassfishrobot Commented Reported by [email protected]
@glassfishrobot Commented kohsuke said: This is a spec issue.
@glassfishrobot Commented Was assigned to snajper
@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-223