permaculture playing cards*
The moose likes Web Services and the fly likes Generalized Parsing for SOAP Response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Generalized Parsing for SOAP Response" Watch "Generalized Parsing for SOAP Response" New topic
Author

Generalized Parsing for SOAP Response

Imran Akbar
Ranch Hand

Joined: May 06, 2010
Posts: 63
Hi alll,

i am creating a web service client, i have used JAX-WS ,

i'm assigning the response to a result object, i have several methods on the web service, is there any way to create a generalized method which will parse the response object and get the response in delimited String, each method will have different response formats.



relevent XML Code:



it would be great if any one could give their suggestion how this can be handled.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
As far as I understand, you want to be able to handle the response from different kinds of SOAP requests in one and the same way.
This can be done if the contents of the SOAP body is always represented by a JAXB bean. To develop something like this:
- Create an XML schema describing all the different kinds of response objects that may be contained in the SOAP body.
- Use the JAXB schema compiler XJC to create corresponding JAXB bean classes.
- When the client receives the response, it extracts the contents of the SOAP body and then uses JAXB to transform the XML to a Java object tree.
JAXB will select the appropriate JAXB bean class, create an instance of it and populate its properties.
Hope this helps!
 
 
subject: Generalized Parsing for SOAP Response
 
Similar Threads
Reading xml attributes in java
Mapping tinyint
Cannot read childnodes in XML - NEED HELP!
View model ignores custom validation for Double values
bean not populated