File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes extract data from SOAP response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "extract data from SOAP response" Watch "extract data from SOAP response" New topic
Author

extract data from SOAP response

AndreI Sljusar
Greenhorn

Joined: Jan 30, 2006
Posts: 7
Hi everyone,

I use Axis engine.

I can't use web service, but I have an example SOAP response.

How to extract data from this response.

Question: how to deserialize java objects from this response? I have generated java classes using wsdltojava.


Thanks,
Andrei
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Welcome to Javaranch Andrew,
Thanks for posting at the under right forum category.

Regd your question..
Simply, the webserivces works in away that the client will send a SOAP request for which the server will send a SOAP response.
Now Axis is a tool which can help you to automate the above process. With that in mind, the client stub that you have generated using wsdl2java will call the server by sending the soap request and receives back the soap response. The client stub will also read this soap response and gives the reponsse data after deserialization. So the main purpose of this wsdl2java is: it will automatically do the job of serialization and deserialization upon such client-server interaction.

>I can't use web service, but I have an example SOAP response.
In that case, all you need is a simple DOM or SAX based xml parser to read the soap response. You dont need Axis for this.

Please also check our webservices FAQ. http://faq.javaranch.com/view?WebServicesFaq

Feel free to post back your doubts.


Spritle Software Blogs
AndreI Sljusar
Greenhorn

Joined: Jan 30, 2006
Posts: 7
Thanks Balaji for a such a prompt reply.

"The client stub will also read this soap response and gives the reponsse data after deserialization."

It means I can't pass on my soap response as a byte stream, for example to the client stub programmatically and to call the methods.

Andrei
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
No. To my knowledge Axis doesnt work that way.
For instance the axis method Invoke(...) in org.apache.axis.client.Call does all the job for you by calling other related classes.

IMHO, If you always happen to get the input as raw SOAP response without using webservices, then try to use DOM/SAX/JAXB/Castor etc., to read the xml data directly and convert them to my format.
AndreI Sljusar
Greenhorn

Joined: Jan 30, 2006
Posts: 7
I am going to use web servces. Just I develop client side.

The web service server is not ready yet, but I was given a test response with data, which I would like to use to test web service client.

Andrei
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Good.. lets wait and see what other moderators/ranchers suggest for your case.
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
You have wsdl file. Why not just build a fake webservice and it just returns the test response.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41089
    
  44
Or really just a servlet that responds with the pre-generated SOAP response, no matter what you post to it. If it were an actual web service, it would want to add its own headers and such, which would make it difficult to have it generate the exact response you need.


Ping & DNS - my free Android networking tools app
 
 
subject: extract data from SOAP response
 
Similar Threads
SOAP element in Web-Service client proxy
transfer unserilaized objects as SOAP response
SOAP response is losing Body content data
Response from the SOAP server
How to catch a request SOAP message?