Creating Schema for Manually Written DTOs
This topic explains the procedure to generate DTO schema for
your code. The Junos Space SDK provides an EJB-REST wizard for RESTifying
code. As a result of using this wizard, the DTOs and schema for
the code are generated automatically. However, the EJB-REST
wizard does not create schema for any code other than the
Similarly, schemas for code that is manually written are not
automatically generated by the build scripts, and the build
scripts themselves for such code are not automatically generated
by the Junos Space SDK plug-in's Generate
Build Script option.
To create a schema for the DTO for manually written code (not
produced by the EJB-REST wizard), follow these steps:
- In the Eclipse Project Explorer view, right-click the DTO.
- Select the Generate DTO Schema option. The Generate
DTO Schema wizard is launched.
- The DTO schema is generated in the WebSvc project
- You may need to change the name of the schema or the
schema because the wizard does not always generate
a correct schema for manually-written DTOs.
Note that the schema creation dialog will only generate a schema
if it recognizes that your Java class is a valid DTO. For a
class to be considered a valid DTO, it needs to have at least one
field annotated with an @XmlAttribute. In other words, it
must at least have a URI.
Also, note that you should really be using the EJB-REST Wizard,
which generates all the schemas automatically. Using this
manual procedure to generate schemas is not recommended.