File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Getting body from Soap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Getting body from Soap" Watch "Getting body from Soap" New topic

Getting body from Soap

Patricia Samuel
Ranch Hand

Joined: Sep 12, 2007
Posts: 300
HI All,

Can any one please help me to know how to get the result -
I wan to fetch <m:GetStockPrice> part from the Soap Body

Expected result - <m:GetStockPrice>

Would any one help me to achieve this?

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
If you have this XML document in a string, and if you know that you'll always want to retrieve That specific part, and if you're certain that the structure won't change substantially, then some string operations (using indexOf and substring) should do the trick.

Otherwise, you can use an XML parser.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
If you want to use SAAJ read and process the XML, then I have some examples in section 5.7 of my SCDJWS 5 Study Notes.
You can download the document in the SCDJWS Links section here or at
Best wishes!
M Mehta
Ranch Hand

Joined: Aug 03, 2006
Posts: 92
I had a similar requirement of getting body from Soap. I wrote the following code which is working for me. Hope it helps you solving the problem.

I agree. Here's the link:
subject: Getting body from Soap
jQuery in Action, 3rd edition