axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesper Söderlund <>
Subject RE: Arrays and derived types..
Date Tue, 03 Sep 2002 10:15:46 GMT
A reply to my own mail, I just thought I'd share my findings in case anybody wants to do the
same thing.
With Axis beta 3 it appears that it's possible to do what I wanted
With the following code:
         call.registerTypeMapping(Attribute.class, attributeType,
              new org.apache.axis.encoding.ser.BeanSerializerFactory(Attribute.class, attributeType),
              new org.apache.axis.encoding.ser.BeanDeserializerFactory(Attribute.class, attributeType));
         call.registerTypeMapping(MegaAttribute.class, megaAttributeType,
              new org.apache.axis.encoding.ser.BeanSerializerFactory(MegaAttribute.class,
              new org.apache.axis.encoding.ser.BeanDeserializerFactory(MegaAttribute.class,

        Attribute[] subjectAttributes =  {new Attribute(), new Attribute(), new MegaAttribute()};
        subjectAttributes[0].setValue("Joe Blow");
        ((MegaAttribute)subjectAttributes[2]).setExtra("Extra pris");
          Object ret = call.invoke(new Object[] { subjectAttributes });

the "on the wire" serialization looks like this
   <subjectAttributes xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="ns4:Attribute[3]" xmlns:ns4="">
     <name xsi:type="xsd:string">commonname</name>
     <value xsi:type="xsd:string">Joe Blow</value>
     <name xsi:type="xsd:string">organization</name>
     <value xsi:type="xsd:string">SmartTrust</value>
    <item xsi:type="ns4:MegaAttribute">
     <name xsi:type="xsd:string">Mega</name>
     <value xsi:type="xsd:string">DEAL!</value>
     <extra xsi:type="xsd:string">Extra pris</extra>
The deserialization also worked smoothly. Great job!
Whether this is interoperable, I don't know as I haven't tested it against any other SOAP-implementations.
Does anybody have some insights whether the serialization made by axis is interoperable with
other SOAP-implementations?

	-----Original Message-----
	From: Jesper Söderlund 
	Sent: den 2 september 2002 15:45
	Subject: Arrays and derived types..
	According to the SOAP- specification in an array you can have types of the specified array
type and derived types.
	The schema would look similar to this (taken from XML Schema specification):
	<complexType name="Address">
	   <element name="name"   type="string"/>
	   <element name="street" type="string"/>
	   <element name="city"   type="string"/>
	<complexType name="USAddress">
	   <extension base="ipo:Address">
	     <element name="state" type="ipo:USState"/>
	     <element name="zip"   type="positiveInteger"/>
	Any ideas how this works in Axis? Any difference between document style and RPC-style?

View raw message