styx
styx

Reputation: 421

java soap webservice xml to object

i have to write a simple soap webservice, which takes it's XML parameter input and calls a database stored procedure with that XML parameter. The stored procedure returns XML (same XSD), and i have to return this result-XML to the webservice caller.

What is the easiest way to produce the result XML in java? Do i have to make java objects out of the result of the stored procedure (if so, whats the easiest way?) or can i somehow put that resulting XML directly in the response of the webservice. As of now i don't need to check the result for validity.

So far i created the wsdl, generated java classes from the xsd, and created the procedures of the webservice. i test them with SoapUI, they call the database stored procedure and i'm not sure how to handle the XML result.

Thanks!

Upvotes: 0

Views: 675

Answers (1)

Saeed
Saeed

Reputation: 616

for binding XML schema to java class and vice versa you can use JAXB. and yes, you can send xml as your response directly. you should set your response content type to xml:

response.setContentType("text/xml");

Upvotes: 1

Related Questions