This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Web Services and the fly likes Getting body from Soap Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "Getting body from Soap" Watch "Getting body from Soap" New topic
Author

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>
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>

Would any one help me to achieve this?
Thanks
Patricia


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35250
    
    7
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.


Android appsImageJ pluginsJava web charts
Ivan Krizsan
Bartender

Joined: Oct 04, 2006
Posts: 2193
Hi!
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 http://www.javaforum.se/jforum/posts/list/549.page
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.



Thanks,
Me
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting body from Soap
 
Similar Threads
How to convert string to xml file in java
Trouble hand rolling SOAP request
Error processing response from .NET web service
Web service to validate US states, city and zipcode
Getting Bad Response from Web service