web services - A message body writer for Java type, class bookInfoListType, and MIME media type application/xml was not found -
I've been browsing stackoverflow recently for this error and I'm unable to find a solution on almost all threads . This is the reason why I am posting this question here.
The problem is that I am saying the error in answering. My XSD definition is:
& lt; Xs: element name = "bookInfoList" & gt; & Lt; XS: complexType & gt; & Lt; XS: Sequence & gt; & Lt; Xs: element name = "bookInfo" type = "bookInfoType" minOccurs = "0" maxOccurs = "unbounded" /> & Lt; / XS: sequence & gt; & Lt; / XS: complexType & gt; & Lt; / XS: element & gt; & Lt; Xs: element name = "bookInfo" type = "bookInfoType" /> & Lt; Xs: complex type name = "bookInfoListType" & gt; & Lt; XS: Sequence & gt; & Lt; Xs: element name = "bookInfo" type = "bookInfoType" minOccurs = "0" maxOccurs = "unbounded" /> & Lt; / XS: sequence & gt; & Lt; / XS: complexType & gt; & Lt; Xs: complex type name = "book infinite" & gt; & Lt; XS: Sequence & gt; & Lt; Xs: element name = "book id" type = "xs: string" minOccurs = "1" maxOccurs = "1" /> & Lt ;! - ... more elements! - & gt; & Lt; / XS: sequence & gt; & Lt; / XS: complexType & gt; created the following bookListInfoType class @XmlAccessorType (XmlAccessType.FIELD) @XmlType (name = "bookInfoListType") PropOrder = {"bookInfo"}) Public Book Book InfoListType {secure list & lt; BookInfoType & gt; BookInfo; Public listing & lt; BookInfoType & gt; GetbookInfo () {if (bookInfo == faucet) {bookInfo = New Arrestist & lt; BookInfoType & gt; (); } Return it BookInfo; }} But when I send back a response like
Help with Stats (HTTPits.Sc_OK). (ATTI (bookInfoListConverter.convert (wsContext, all books)). Build (); I think the error gets.
In my ObjectFactory , I see public book infographic type CreatebookInfoListType () {Return to new book INFOListType}} < / Pre> Here's my remaining method:
@Path ("v1 / storename /") Public Square BookResource {@GET @Path ("Books / {} book_id / info. Xml ") @Produces (MediaType.APPLICATION_XML) Public Response getBookInfoXML () {// Business Logic Returns Response.status (HttpStatus.SC_OK) .entity (bookInfoListConverter.convert (wsContext, allBooks)). Construction (); }} , I have another JACB generated class which is called bookInfoList as you can see in XSD. Their definition is almost identical (this is one thing I suspect is the problem that may be, but my classes which are following the same pattern are doing fine) I still I am trying to get dashed on my head, but I am thinking that any help would be appreciated.
The stream can be made in serial form from jersey, returned from the processing method. Of course, while JAX-RS implementations provide the default support for the most common combination of Java type and it has the on-the-wire representation formats, JAX-RS implementation conversion for any arbitrary Java type and any arbitrary representation The above described format does not support the format by default. Come with JAX-RS implementation) You know a provider should be in how to handle the combination, so that you must have the appropriate MessageBodyWriter and < Code> MessageBodyReader sections (see link above for if you have to write them how you can write - you are using the exact documentation for JX-RS implementation / version). He said, since your mistake is a little weird, jerseys can already support the default for the entity provider who can be a marsh all JAXB beans You can compare your service to a tutorial (eg. .) So that it can be ensured that the error you have posted is not red herring
Comments
Post a Comment