I have an exception hierarchy like the following:
Exception
+--MATEException
+--DocumentException
+--BadFileAttachmentExceptionI'm using java2wsdl to generate my WSDL file, and it seems to be generating OK: [snip] <schema targetNamespace="http://digilore.com/mate/exceptions" xmlns="http://www.w3.org/2001/XMLSchema"> <complexType name="MATEException"> <sequence> <element name="cause" nillable="true" type="xsd:anyType"/> <element name="message" nillable="true" type="xsd:string"/> </sequence> </complexType> </schema> <schema targetNamespace="http://digilore.com/mate/engine/exceptions/document" xmlns="http://www.w3.org/2001/XMLSchema"> <complexType name="DocumentException"> <complexContent> <extension base="tns5:MATEException"> <sequence/> </extension> </complexContent> </complexType> <complexType name="BadFileAttachmentException"> <complexContent> <extension base="tns7:DocumentException"> <sequence/> </extension> </complexContent> </complexType> [snip] My methods are declared as throwing DocumentException, but in the actual code, it throws a BadFileAttachmentException. In a regular Java app, this exception could still be caught as a BadFileAttachmentException. Through the web service however, I'm only able to catch DocumentException. The SOAP fault that gets transmitted back looks like this: <soapenv:Fault> <faultcode>soapenv:Server.userException</faultcode> <faultstring>com.digilore.mate.engine.exceptions.document.BadFileAttachmentException: The number of attachments (2) does not equal the number of md5 sums (1).</faultstring> <detail> <com.digilore.mate.engine.exceptions.document.DocumentException xsi:type="ns1:BadFileAttachmentException" xmlns:ns1="http://digilore.com/mate/engine/exceptions/document"> <message xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">The number of attachments (2) does not equal the number of md5 sums (1).</message> </com.digilore.mate.engine.exceptions.document.DocumentException> <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">Matt</ns2:hostname> </detail> </soapenv:Fault> Client side, I'm using wsdl2java to generate stubs, and it will deserialize the exception to DocumentException, but not to the subclasses. Is there some way to be able to catch the subclass of DocumentException, rather than DocumentException? Thanks Matt McMinn DigiLore [EMAIL PROTECTED]
signature.asc
Description: This is a digitally signed message part
