Zebensui Méndez created CXF-4292:
------------------------------------
Summary: Incorrect code generated with wadl2java tool when use
JAXB binding and XML symple type with restriccion.
Key: CXF-4292
URL: https://issues.apache.org/jira/browse/CXF-4292
Project: CXF
Issue Type: Bug
Reporter: Zebensui Méndez
Attachments: cxf_2_6_0_wadl.zip
If we have an XML schema with a simpleType that has a restriction, the tool is
not able to determine the basic type of java.
Example:
<xs:simpleType name="DetailType">
<xs:annotation>
<xs:documentation>DetailType for WADL is used to indicate the
possible values for a WADL Resource parameter.
This parameter specifies the desired amount of information to
be returned.
For example, it is possible to instruct the web service to
return only basic information about the maintainable artefact (i.e.: id, agency
id, version and name).
Most notably, items of item schemes will not be returned (for
example, it will not return the codes in a code list query).
Possible values are: "allstubs" (all artefacts should be
returned as stubs ), "referencestubs" (referenced artefacts should be returned
as stubs )
and full (all available information for all artefacts should be
returned ).
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="allstubs"/>
<xs:pattern value="referencestubs"/>
<xs:pattern value="full"/>
</xs:restriction>
</xs:simpleType>
And the generated code is:
@Path("datastructure/{agencyID}/{resourceID}/{version}")
public interface Datastructure {
@GET
@Produces("application/vnd.sdmx.structure+xml;version=2.1")
StructureType MaintainableArtefactQuery(@QueryParam("detail")
@DefaultValue("full") DetailType detail, @QueryParam("references")
@DefaultValue("none") ReferencesType references);
}
But DetailType doen't have JAXB binding because is a simpleType (a String). The
the correct code would be:
@Path("datastructure/{agencyID}/{resourceID}/{version}")
public interface Datastructure {
@GET
@Produces("application/vnd.sdmx.structure+xml;version=2.1")
StructureType MaintainableArtefactQuery(@QueryParam("detail")
@DefaultValue("full") String detail, @QueryParam("references")
@DefaultValue("none") ReferencesType references);
}
Please run the attached code (mvn generate-sources with java parameters
-Xms512M -Xmx1024M) to reproduce the issue. Then see for example the class
"Datastructure".
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira