Reputation: 8704
I have been doing lots of googling lately trying to find a decent documentation/tutorial to consume XML in JAVA RestFUL implementation of webservice. My requirements are simple
Which means that i need XML in raw. I don't need any JAXB binding or any objection conversation. Can someone point me to some decent tutorial or post something here
@POST
@Consumes(MediaType.APPLICATION_XML)
public void consumeXML (/*something here- duno what*/){
//something here as well
}
thanks
Upvotes: 3
Views: 2169
Reputation: 149007
I would recommend specifying an InputStream
as the method parameter.
@POST
@Consumes(MediaType.APPLICATION_XML)
public void consumeXML ( InputStream xml ){
//do something with the XML string
}
Then the InputStream
can be processed using any number of technologies: DOM, SAX, StAX, JAXB, etc.
Upvotes: 2
Reputation: 2336
public void consumeXML ( String xml ){
//do something with the XML string
}
Upvotes: 0