• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Best way to transform javax.xml.transform.Source to java object?

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am calling some web services using "webServiceTemplate1.marshalSendAndReceive". Request is going successfully but while parsing the response, I am getting ClassCastException!!! I searched a lot over google. Seems this error can be because of multiple issue like namespace, xmlrootelement etc. I have tried but problem still persists. So decided to form the Response through my own custom extractor by implementing interface org.springframework.oxm.Unmarshaller.

As per the interface I have to implement the below interfaces. I have checked that response is available in Source but not able cast it. Even I tried to marshal to xml and unmarshalling back, nothing!!!
So without wasting my time, I want to build JAXB Object through Source. Would you point me to the best/efficient approach for the same. eg. should I manually iterate or xpath or something else that should be fast and without any performance issue.


public boolean supports(Class<?> arg0);
public Object unmarshal(Source arg0) ;

Thanks in advance.

Thanks,
VickyB
 
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am getting ClassCastException!!! I searched a lot over google. Seems this error can be because of multiple issue like namespace, xmlrootelement etc. I have tried but problem still persists.


Hi Vicky,

Post that exception trace and the response XML here. Perhaps somebody here can help you solve the root cause itself.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic