Reputation: 86865
What are efficient ways to work with RESTful JSON
webservices?
Best would be for me if I could work with POJOs
that are auto-filled somehow after calling a webservice that responds with JSON
data string.
The webservice does not provide any schema data like WSDL or XSD.
I know Jackson
library can transform json strings into pojos. But therefore the pojos have to exist before.
So, how could I best auto-generate them, preferably using Jackson annotations.
Or otherwise, could you recommend different frameworks?
Upvotes: 0
Views: 104
Reputation: 106
One way i can think of is to call the restful web service(jax-rs) and use the accept application/xml http header flag, this will return you an xml representation. Then use xjc and jaxb to create a schema and jaxb pojos from the xml, you can then use the same jaxb objects with the accept application/json http header and it should be auto converted into the jaxb java object from the json response. But then again you could have just created a pojo yourself and annotated it with jaxb annotations in the first place.
Upvotes: 1