• Post Reply Bookmark Topic Watch Topic
  • New Topic

Serializers/Deserializers for custom complex Java objects

 
WarnerJan Veldhuis
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am looking for a guide to tell me how to write serializers/deserializers for my complex java object. My class is too complex to be a JavaBean, so the BeanSerializer will not help me.
I know org.apache.axis.encoding is the package to look at, but I am confused with all the interfaces and baseclasses that are offered there. Even looking at the sourcecode of the objects in org.apache.axis.encoding.ser didn't shed light on it... The documentation from AXIS on creating serializers/deserializers isn't much of a help... Anyone got some more info??
Thnx in advance
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you had a look at the worked example available order for axis.? Lets us know if it is not helping you to get started.
 
Stan Sokolov
Ranch Hand
Posts: 120
Hibernate IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You bassicaly don't need to write your own serializer. But jast specify
a mapping between the java class and WSDL element in the *.wsdd file.
If you need an example write me email I will send it to your.
The little example is
Be carefull about the namespace. It should be the same like you use
in the WSDL document
<typeMapping
xmlns:ns = "presentation.server.mpas.company.com"
qname = "ns acket"
type = "java:com.company.mpas.server.presentation.Packet"
serializer = "org.apache.axis.encoding.ser.BeanSerializerFactory"
deserializer = "org.apache.axis.encoding.ser.BeanDeserializerFactory"
encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"
/>
 
WarnerJan Veldhuis
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem with this class is that it't not a javabean-compatible class, and I can't do anything about that. Having the BeanSerializer here is not an option.
The type mapping as I have it is like this:

This works so far, since I can actually generate output with the Serializer.
There is a new problem on the horizon: adding SOAPHeaders during serializing does NOT generate the desired headers, but also no exceptions are thrown.... This puzzles me... Anyone added headers during serialization?
 
Raj Chila
Ranch Hand
Posts: 128
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
by looking at the name of the Serializer Factories, it looks like you are parsing some String and trying to create a SOAP Message.
could you not as well create a Bean that will cater to the requirements.
any way, you must be knowing the need to create your own (De)serializers. but did you consider extending the extending the BeanSerializer / Deserializer Factories and creating the Serializer / Deserializer extending the Bean Serializers and the Deserializers in the encoding.ser Package of axis?
I dont know but it could also mean that your Serializers be qualified in the same package structure.
I dont know if this would do any bit to solve the problem, but I think it would be worth a try.
[ April 15, 2004: Message edited by: RajaniKanth Bhargava ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!