Bug 5622 - WSDL2Java does not serialize xsi:type on fault types
: WSDL2Java does not serialize xsi:type on fault types
Status: NEW
: Java WS Core
: 4.0.4
: PC All
: P3 major
: ---
Assigned To:
  Show dependency treegraph
Reported: 2007-10-18 07:39 by
Modified: 2007-10-18 08:20 (History)



You need to log in before you can comment on or make changes to this bug.

Description From 2007-10-18 07:39:13
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
IOException {        
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.


------- Comment #1 From 2007-10-18 08:20:37 -------
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.