aspose file tools*
The moose likes Web Services and the fly likes axis2. xsi:type object mapping does not work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "axis2. xsi:type object mapping does not work" Watch "axis2. xsi:type object mapping does not work" New topic
Author

axis2. xsi:type object mapping does not work

Vladimir Duloglo
Greenhorn

Joined: Jun 23, 2010
Posts: 1
I have a following setup

Two objects:

ObjectB extends ObjectA

A webservice with a method: getObject(ObjectA obj)

In wsdl these objects defined like:

<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://mypackage.com/xsd">
<xs:complexType name="ObjectA">
<xs:sequence>
<xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ObjectB">
<xs:complexContent>
<xs:extension base="ax21:ObjectA">
<xs:sequence>
<xs:element minOccurs="0" name="phone" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>

From the client I am calling this method by passing to it Subclass -- ObjectB:

ObjectB obj;
getObject(obj);

In the request XML object is represented like that:

<obj xsi:type="q1:ObjectB" xmlns:q1="http://mypackage.com/xsd">
<id>1</id>
<name>test</name>
<q1:phone>123</q1:phone>
</obj>

But on the server side no matter if I am passing instance of ObjectA or instance of ObjectB i am getting always instance of superclass ObjectA, even when xsi:type specifies that object is of subclass ObjectB type. As a result I am not getting values present on ObjectB and getting only values defined in superclass ObjectA.

Same structure worked fine in axis1 ans xsi:type was respected.

Maybe it is some configuration in axis2.

I would be really thankful for any help.
R Srini
Ranch Hand

Joined: Feb 19, 2010
Posts: 215
Hi. I haven't seen this before, but maybe this is related to your problem. Best of luck!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: axis2. xsi:type object mapping does not work