This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets 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

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!
subject: axis2. xsi:type object mapping does not work
Similar Threads
XMLSpy won't work with our AXIS2 WSDL but our system works with it fine
complextype with Axis2
File does not exist in the Service Repository! File=META-INF/ServiceData.xml
XmlException on calling WSDL2Java
REST client with POST verb - some help needed