5

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
} 
user692942
  • 16,398
  • 7
  • 76
  • 175
vivek
  • 4,599
  • 3
  • 25
  • 37

1 Answers1

6

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.

vicky
  • 1,046
  • 2
  • 12
  • 25