Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Element in Wadl representation

I have an JAX-RS API and I'm generating wadl for it.

<application ....
    ..
    <request>
        <representation mediaType="application/xml"/>
    </request>
..
</application>

But I want add element to representation to it.

<application ....
    ..
    <request>
        <representation mediaType="application/xml" element="prefix1:thebook"/>
    </request>
    ..
</application>

thebook should present in grammar.

My Service:

@Path("/update/book")
@POST
@Produces({MediaType.APPLICATION_JSON})
@ElementClass(request = Book.class)
@Consumes({MediaType.APPLICATION_XML})
String updateBook(Book book);

Book.java

@XmlRootElement(name = "inventoryBean")
public class Book {
    private Long name;
    private Long id;

    // getters and setters
} 
like image 861
vivek Avatar asked Oct 28 '13 07:10

vivek


People also ask

What is WADL format?

The Web Application Description Language (WADL) is a machine-readable XML description of HTTP-based web services. WADL models the resources provided by a service and the relationships between them. WADL is intended to simplify the reuse of web services that are based on the existing HTTP architecture of the Web.

What is WADL feature?

WADL is the language instructed for explaining the traits or segments of HTTP web solutions/applications. Description of the app's all HTTP resources alongside their correlations and dependencies can be provided using it.

What is a WADL in REST?

The Web Application Description Language (WADL) is an XML-based file format that describes your REST web services application. By default, a basic WADL is generated at runtime and can be accessed from your REST web service by adding a GET to the /application. wadl resource at the base URI of your REST application.

What is the difference between WSDL and WADL?

WSDL is an XML language for describing web services. Used to describe SOAP-based web services. WADL is an XML file-format . It is an XML vocabulary for expressing the behavior of HTTP resources.


1 Answers

There has to be a namespace declared somewhere, either in @XmlRootElement itself or in a package-level annotation, please add it and you should see a proper link to a schema element;
In this case @XmlRootElement(name = "inventoryBean", namespace = "bean") should do the job.

like image 88
vicky Avatar answered Dec 03 '22 02:12

vicky