janani
janani

Reputation: 31

How to parse the response SOAP message in Java servlet?

I am working on a SOAP webservice. I am done with sending a SOAP request to get an XML response.

I don't have an idea of parsing the response SOAP message in a servlet or JSP.
Can anyone suggest a solution?

Upvotes: 0

Views: 6469

Answers (1)

aroth
aroth

Reputation: 54796

I would strongly recommend that you use something like JAXB to parse the response XML into plain Java objects that are much easier to work with.

In a nutshell, you just need to feed your webservice's WSDL file into JAXB, and it will generate a set of classes appropriate for the service's responses and a parser for handling the response XML.

Here's a brief tutorial if you're using NetBeans: http://netbeans.org/kb/docs/websvc/jaxb.html

Or if you're using Maven: http://blog.dawouds.com/2008/09/maven-2-wsdl-to-java-using-jaxb.html

Upvotes: 1

Related Questions