Bugzilla – Bug 5622
WSDL2Java does not serialize xsi:type on fault types
Last modified: 2007-10-18 08:20:37
You need to
before you can comment on or make changes to this bug.
Apologies in advance if this bug has already surfaced before or it has been
solved in later versions.
Custom fault classes generated by WSDL2Java do not serialise xsi:type
information. This seems related to the method writeDetail() which is generated
with an implementation of:
public void writeDetails(QName qname, SerializationContext context) throws
context.serialize(qname, null, this);
which explcitly does not serialise any attribute (second parameter is null).
The end result is lack of 'subtyping' on faults and thus the necessity that all
clients catch explicitly all the subclasses of an exception hierarchy. A manual
modification to the generated stubs is required to restore subtyping on faults.
(As far as I can tell Axis src code -- at least in vanilla version 1.4 -- shows
the intention to parse the fault with the class specified in <exceptionName>,
but it actually doesn't. so xsi:type remains the only solution.)
I could not think of any other temporary solution to this problem (xsi:type
information can only be generated from WSDL information and this seems to
survive only in auto-generated fault classes). Any suggestion appreciated.
A rectification: the lack of subtyping for faults implies that _the service_
has to explicitly declare all the classes it may throw out of a potentially
large fault hierarchy.