Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Convert axis generated java beans to xml

 
Gurvinder Singh
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • 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


 
g tsuji
Ranch Hand
Posts: 666
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would java.beans.XMLEncoder and XMLDecoder classes serve you any good?
 
Sathiesh Kumar Vs
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic