• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

extract data from SOAP response

 
AndreI Sljusar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
AndreI Sljusar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good.. lets wait and see what other moderators/ranchers suggest for your case.
 
wise owen
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have wsdl file. Why not just build a fake webservice and it just returns the test response.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic