This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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!
Have you checked out Aspose?
subject: axis2. xsi:type object mapping does not work
It's not a secret anymore!