简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM