You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "sreekantan, vijay" <vi...@yahoo.com> on 2004/06/15 22:02:15 UTC

xsi:type on the fault detail element for derived exceptions

I have a situation where I have a web service that declares itself as throwing a base exception, but the implementation throws a derived exception.
 
I have typemappings defined for bot the base and derived exceptions in my server-config.wsdd file.
 
Axis when throwing the fault, correctly serializes the derived fault, but does not include the xsi:type information of the derived exception.
 
It works perfectly fine with structures but not with exceptions. 
 
Here is an example.
 
The operation element in the server-config.wsdd
 
<operation name="methodTestExternalExtension"
             qname="methodTestExternalExtension"
             returnQName="ns1:methodTestExternalExtensionOutput"
             returnType="ns2:someclass"
             xmlns:ns1="urn:WSDLNamespace"
             xmlns:ns2="urn:ServiceNamespace">
   <parameter qname="ns1:methodTestExternalExtensionInput"
             type="ns2:ConcreteExtensionB"
             xmlns:ns1="urn:WSDLNamespace"
             xmlns:ns2="urn:ServiceNamespace"/>
   <fault class="com.somecompany.BaseException"
          qname="ns1:baseExceptionError"
          type="ns2:baseException"
          xmlns:ns1="urn:WSDLNameSpace"
          xmlns:ns2="urn"ServiceNameSpace"/>
  </operation>
 
In my implementation I throw com.somecompany.ConcreteException which is of type {urn:ServiceNameSpace}concreteException and extends com.somecompany.BaseException
 
I have typemapping elements for both the exceptions.
The fieldOne and fieldTwo belong to the ConcreteException.
 
When I serialize I get this 
 
<detail>
    <ns1:abstractExceptionError xmlns:ns1="urn:SomeNamespace">
     <fieldOne>two</fieldOne>
     <fieldTwo>three</fieldTwo>
    </ns1:abstractExceptionError >
   </detail>
 
instead of 
 
<detail>
    <ns1:abstractExceptionError xsi:type="ns2:concreteException" xmlns:ns1="urn:SomeNamespace"
xmlns:ns2="urn"ServiceNameSpace"/>
     <fieldOne>two</fieldOne>
     <fieldTwo>three</fieldTwo>
    </ns1:abstractExceptionError >
   </detail>
 
Is this a known bug in Axis.
 
Does anyone know any workarounds.
 
Thanks
Vijay
 


		
---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!