Scott, I am very interesting in this topic and are looking for your help.
If my Java Bean has other objects as the data type and inner classes, Do I need to type mapping for all the other classes which are used in this Java Bean in deployment descriptor? How about the inner class? Do I need to write customized serializes for each object classes which are used in this Java Bean? Do you have any bean serialize examples I can take a look? Or any places that have a good example? Thanks, Emily At 03:54 PM 7/12/2002 -0400, Dunn, Scott wrote: >I have type mappings and hence serialisers for all my classes, however, when >serialising the return value Axis uses the xml type rather than the actual >value type when determining which serialiser to use. > >I have solved the problem by writing a custom serialiser that figures out >the 'real' class and delegates the serialisation to the appropriate >serialiser as in the following code sample: > > public void serialize(QName name, Attributes > attributes, Object value, SerializationContext > context) // Check for meta-data in the bean that will tell us if any > of the // properties are actually attributes, add those to the > element // attribute list AttributesImpl beanAttrs > = (AttributesImpl)getObjectAttributes(value, attributes, > context); // We need to update the xsi:type attribute which is > currently set to // ManagedEntityValue or ManagedEntityKey. It needs > to be updated to // reflect the actual type of the object being > serialized. QName actualXmlType = > context.getQNameForClass(value.getClass()); int index = > beanAttrs.getIndex("xsi:type"); beanAttrs.removeAttribute(index); > beanAttrs = >(AttributesImpl)context.setTypeAttribute((Attributes)beanAttrs, >actualXmlType); // Now get the serializer for the actual Java type and >delegate the // serialization to it. Serializer ser = >context.getSerializerForJavaType(value.getClass()); ser.serialize(name, >attributes, value, context); >Scott. > > > ---------- > > From: Stickley, Jim > > Reply To: [EMAIL PROTECTED] > > Sent: Friday, July 12, 2002 12:37 PM > > To: '[EMAIL PROTECTED]' > > Subject: RE: Serialization of return values and inheritance > > hierarchies > > > > Do you define a Serializer in your deploy.wsdd file for all your classes, > > or > > just the abstract class? I'm not sure if this will fix your problem, but > > I > > believe that Axis will only serialize the classes that are specified in > > the > > wsdd file. The only thing I'm not sure of is if Axis will match the class > > being returned to the correct serializer based on the type specified by > > the > > return or by the actual type. You will find out for sure if you have > > serializers defined for all the concrete class types. > > > > Jim Stickley > > Birch Telecom > > (816) 300-6743 > > [EMAIL PROTECTED] > > > > > > -----Original Message----- > > From: Dunn, Scott [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, July 11, 2002 2:10 PM > > To: [EMAIL PROTECTED] > > Subject: Serialization of return values and inheritance hierarchies > > > > I have a very granular interface which defines a small number of > > operations > > (5) on a large number of entities ( > 100). Rather than having an > > interface > > that defines more than 500 methods I have all the entities extend a base > > class and define the interface in terms of the base class. By ensuring > > that > > all the required type mappings exist in the deployment descriptor this > > works > > fine for the request portion of the message. i.e. Axis correctly figures > > out > > how to deserialize the parameters that are passed in the SOAP message even > > though the operation is defined in terms of the base class. However, the > > return value does not work in the same fashion. Axis does not pay any > > attention to the actual class of the return value and instead uses the > > operation definition only, which results in all the properties being lost. > > > > Should this be the case? Is it not reasonable to expect that Axis would > > serialize the object according to its actual class? > > > > Thanks, > > > > Scott. > > > >