Hi Pär,
 
I am also quite dazzled. At least in Axis2 1.2, the exception class generated 
for the service implements serialization methods, and in fact there are 
Hundreds (!!!!) of lines of code for just a simple service. 
 
I do not know if this is the way to go. For a simple service just doing an 
addition of two numbers, and having 3 kinds of exceptions thrown, this is 
somewhat absurd (I pasted the code to a word document - 157 pages...). 
 
I don't think that component-code (business logic) should be mixed with code 
specfici to the Axis2 framework. I think that what WSDL2JAVA does should in 
fact for the most be generated and handled at runtime, or when the service is 
deployed - but all of this should be kept hidden to the developer. Also, when 
looking at the client code, it is just overbloated with 
service-/xml-/axis-specific code. 
 
I am now investigating methods to call webservices through EJB/JBoss via a 
stateless session facade. I hope to see a cleaner separation of business logic 
and "technical" code there. 
 
Keep me updated with your results, thanks in advance,
 
Jay

-----Original Message-----
From: Pär Malmqvist [mailto:[EMAIL PROTECTED]
Sent: jeudi 4 octobre 2007 15:20
To: axis-user@ws.apache.org
Subject: AxisFault and CustomException



Hello!
 
I have created a simple Axis2 service called MyService, se code below. It has 
one method: addOneToPositiveValue. If it is called with a negative value it 
throws a CustomException.
I have created a MyService.aar and deployed it on Axis2 1.3 and Tomcat 5.5.23
 
Then I created a simple client with wsdl2java and xmlbeans style.
 
Its really hard to get the CustomException in an easy way at the client side.
The AxisFault.getDetail() displays the name of the exception deep down in some 
kind of stacktrace. Thats all.
 
Can you Axis2 gurus have a look at it please?
If I haven't missed anything I think something has to be done to make this 
easier.
 
Thanks.
 
/Pär
 

package axis2test;
public class MyService {
    public MyService() {
    }
    public int addOneToPositiveValue(int value) throws CustomException {
        if(value < 1) {
            throw(new CustomException());
        }
        
        return(value + 1);
    }
}
 
package axis2test;
public class CustomException extends Exception {   
    private static final long serialVersionUID = 999999999;
    public CustomException() {
        super();
    }
    public String toString() {
        return(super.toString() + ' axis2test.CustomException');
    }
}
 
<service name='MyService' scope='application'>
    <description>
        This is a webservice for MyService
    </description>
    <messageReceivers>
        <messageReceiver mep=' http://www.w3.org/2004/08/wsdl/in-out'
                         
class='org.apache.axis2.rpc.receivers.RPCMessageReceiver'/>
    </messageReceivers>
    <parameter name='ServiceClass' 
locked='false'>axis2test.MyService</parameter>
</service>


  _____  

Get news, entertainment and everything you care about at Live.com. Check it 
out! <http://www.live.com/getstarted.aspx>  

Reply via email to