• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to get SOAP response as XML in Client Struts or Servlet. ?

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

I am using JAX-RPC. Currently my client (Struts Action) get Web Service response as JAVA object. But I need that response ax XML.

I am able to retrive SOAP request / response as XML directly by writing Handlers for Server and Client. Handler are triggered on Req and response and can do some processing on SOAP messages.

But I need that XML SOAP Response in my Struts Action Class or Servlet. How can I access that ? Please advice.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure how to do this with JAX-RPC, but if you need to work with the SOAP on such a low level you may be better off using SAAJ instead. It's easy to get an javax.xml.transform.Source object from the SOAP response, which you then can use as you see fit.
[ November 06, 2008: Message edited by: Ulf Dittmer ]
 
Arpit Goel
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for response.

Issue is like this that If I add/remove attributes in WSDL for some client, I need to have all client with modified Java Object Code for Deserialiation to avoid any deserialization error.

So to avoid that I think I need to get web service response as direct XML ( Not Attachment ) so different client can customize the response xml using xml binding for their use. Currently my implementation uses marshaling / unmarshalling of objects so I get data as JAVA Data Objects (DTOs ). How can I access SOAP body contents in client Web App ( Not in Handlers ) in JAX-RPC without changing my current implementaion to SAAJ.

Or is there any way we can define whether client can skip deserialization of attribute if that attribute is not availablbe in client Side skelton classes.
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Won't Apache SOAP will help you in this??
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apache SOAP has been obsolete for years; don't use it. (It's not even listed on ws.apache.org any more.)
 
Amit G Piplani
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i agree SOAP is obsolete, sorry for posting that as recommendation...

Although JAX-WS provides Dispatch and Provider functionality to operate at the XML message level.
 
Amit G Piplani
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But again JAX-WS is used with JEE 1.5 onwards, and its not a solution if you are using J2EE 1.4.
Although it looks like using SAAJ and Message Handler can work it out

Ulf/Arpit, will web service versioning help in this case? As per Arpit's requirement, he is willing to change some attributes in WSDL(mostly in Schema), will web service versioning help in this case?
 
The harder you work, the luckier you get. This tiny ad brings luck - just not good luck or bad luck.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic