axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Daniels <>
Subject [axis2] WSDL2Java / Java2WSDL and Faults (PLEASE CHIME IN?)
Date Mon, 11 Jun 2007 21:53:44 GMT
Hi folks!

We're here at the hackathon, and these two issues came up:

They both revolve around how to map faults to/from WSDL, and we'd like 
some input.  Consider starting with the following class:

package ns;
class Service {
   void method1(void) throws CustomException {};
   void method2(void) throws CustomException {};

You'll end up with a WSDL that looks like (paraphrased):

<schema targetNamespace="http://ns">
   <element name="CustomException">
<message name="{MSG}">
   <element name="ns:CustomException"/>
<operation name="method1">
   <fault message="{MSG}"/>
<operation name="method2">
   <fault message="{MSG}"/>

I've left MSG as a variable because that's the real question here.  In 
particular, should MSG be based on a) just the Exception type (i.e. 
"CustomException"), or b) the method (i.e. "method1Fault").  If we go 
with (a), then we would generate only ONE message for both of the above 
operations' faults and share it.  If we go with (b) we would generate 
TWO separate messages in the WSDL, both referring to the same element.

Now the second part revolves around how to behave when running WSDL2Java 
from WSDL.  Should we generate:

class {MSG} extends RemoteException {

(i.e. use the message name regardless, meaning we'd generate multiple 
exception types for multiple messages sharing an element)


class CustomException extends RemoteException {

(i.e. use the element type regardless of message name)

Currently, for Java2WSDL we use approach (b), generating message names 
based on the method name.  For WSDL2Java we use approach (1), generating 
fault types based on the message name.  If multiple messages share the 
same element, we'll all have them use the same fault class (based on the 
message name, not the element name).

The current approach is somewhat inconsistent and confusing.  We should 
EITHER have WSDL2Java generate one fault per message (if the faults are 
named after message names), letting the Java classes be different even 
though the elements are the same, OR have it dig in to the element and 
name the faults after the element types, and sharing the fault type 
among any operation that uses that element in a fault message.

Thoughts and comments appreciated.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message