Meaningless Drivel is fun!
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
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

axis2. xsi:type object mapping does not work

Vladimir Duloglo

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="">
<xs:complexType name="ObjectA">
<xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
<xs:complexType name="ObjectB">
<xs:extension base="ax21:ObjectA">
<xs:element minOccurs="0" name="phone" nillable="true" type="xs:string"/>

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

ObjectB obj;

In the request XML object is represented like that:

<obj xsi:type="q1:ObjectB" xmlns:q1="">

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:
subject: axis2. xsi:type object mapping does not work
It's not a secret anymore!