axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesper Söderlund <Jesper.Soderl...@smarttrust.com>
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:
 
<snip>
         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,
megaAttributeType),
              new org.apache.axis.encoding.ser.BeanDeserializerFactory(MegaAttribute.class,
megaAttributeType));

<snip>
 
        Attribute[] subjectAttributes =  {new Attribute(), new Attribute(), new MegaAttribute()};
        subjectAttributes[0].setName("commonname");
        subjectAttributes[0].setValue("Joe Blow");
 
        subjectAttributes[1].setName("organization");
        subjectAttributes[1].setValue("SmartTrust");
 
        subjectAttributes[2].setName("Mega");
        subjectAttributes[2].setValue("DEAL!");
        ((MegaAttribute)subjectAttributes[2]).setExtra("Extra pris");
 
<snip>
          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="http://www.smarttrust.com/test/">
    <item>
     <name xsi:type="xsd:string">commonname</name>
     <value xsi:type="xsd:string">Joe Blow</value>
    </item>
    <item>
     <name xsi:type="xsd:string">organization</name>
     <value xsi:type="xsd:string">SmartTrust</value>
    </item>
    <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>
    </item>
   </subjectAttributes>
.."
 
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?
 
Regards,
/Jesper
 

	-----Original Message-----
	From: Jesper Söderlund 
	Sent: den 2 september 2002 15:45
	To: axis-user@xml.apache.org
	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">
	  <sequence>
	   <element name="name"   type="string"/>
	   <element name="street" type="string"/>
	   <element name="city"   type="string"/>
	  </sequence>
	</complexType>
	
	<complexType name="USAddress">
	  <complexContent>
	   <extension base="ipo:Address">
	    <sequence>
	     <element name="state" type="ipo:USState"/>
	     <element name="zip"   type="positiveInteger"/>
	    </sequence>
	   </extension>
	  </complexContent>
	</complexType>
	"
	 
	Any ideas how this works in Axis? Any difference between document style and RPC-style?
	 
	Regards,
	/Jesper


Mime
View raw message