• 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

Convert axis generated java beans to xml

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

I have a problem.
I have generated beans using axis2 wsdl2java technique.
I am populating these beans and then finally sending the complete bean containing all the other beans through webservice to the third party.

Now my requirement is to convert this big bean object to xml and keep it in the archive directory.
Now can someone tell me a nice way to convert my java bean object to xml.

Earlier i was using JAXB, but the third party was using axis2 and there was a mismatch while sending my request. So i had to switch to axis2 generated beans.
And now i dont have a parser option to parse my beans to xml.



Thanks


 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would java.beans.XMLEncoder and XMLDecoder classes serve you any good?
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry if I misunderstood your problem

I believe there should not be any problem depending on what the technology that you use and the service provider uses, as long as you both use the same Soap version. That is the core benefit of using a web service.

The beans generation may be different based on different web service frame works as the vendors would use their own binding mechanism, but JAXB is one standard binding technique that everyone wants to move to.

Still the XML generated out of the beans would be same, irrespective of the binding technique. If you still see some differences I think you can use custom handlers to tamper requests and responses
 
Gurvinder Singh
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried to use jaxb with my current ADB beans but when ever i try to create the marshaller, it says Object Factory not found, since adb beans does not have an object factory class in it.
I tried using XStream, but the final xml that i get, the elements are appended with some extra attributes. and the structure is also somewhat not the expected structure.
I tried with XMLEncoder too. seems it is also not sufficing my need.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic