Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4292

Incorrect code generated with wadl2java tool when use JAXB binding and XML symple type with restriction.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.5.4, 2.6.1
    • JAX-RS
    • None
    • Unknown

    Description

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

      Attachments

        1. cxf_2_6_0_wadl.zip
          351 kB
          Zebensui Méndez

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            cromody Zebensui Méndez
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: