axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Cotton <>
Subject User Exception Handling in Axis
Date Tue, 26 Mar 2002 00:10:25 GMT

I'm using Axis to put a web service in front of a stateless session
EJB. This EJB throws user exceptions as part of it's interface.

One of these exceptions encodes an integer fault code. Let's call
this exception com.synxis.srms.exception.SrmsException.

To consume this web service from a java client, I use the following

        1. Java2WSDL on the EJB
        2. WSDL2Java on the generated WSDL
        3. Java client uses generated client stubs 

The generated client code includes its own version of SrmsException
that extends AxisFault. It also carries the integer fault code.

All the client generated interfaces and code all refer to this new

BUT, when the EJB throws this exception, the client is never handed
the generated client-side exception, but instead an instance of the
server side exception.

ok, some details:

Server-side exception is:

The WSDL has this to say:
   <wsdl:message name="SrmsException">
      <wsdl:part name="_code" type="xsd:int"/>

   <wsdl:operation name="getHotelsForUser" parameterOrder="userName">
         <wsdl:input message="intf:getHotelsForUserRequest"/>
         <wsdl:output message="intf:getHotelsForUserResponse"/>
         <wsdl:fault message="intf:SrmsException" name="SrmsException"/>

Client-side generated exception is:

 * This file was auto-generated from WSDL
 * by the Apache Axis Wsdl2java emitter.


public class SrmsException extends org.apache.axis.AxisFault {
    public int _code;
    public int get_code() {
        return this._code;

    public SrmsException() {

      public SrmsException(int _code) {
        this._code = _code;

Tcpmon has this on the wire:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:xsd=""
xmlns:xsi="" xmlns:SOAP-ENC="">
   <faultcode xmlns:ns1="">ns1:Server.userException</faultcode>
    <ns2:stackTrace xmlns:ns2="">com.synxis.srms.exception.SrmsException
	at java.lang.reflect.Method.invoke(Native Method)
	at Source)
	at Source)
	at Source)
	at org.apache.axis.strategies.InvocationStrategy.visit(Unknown Source)
	at org.apache.axis.SimpleChain.doVisiting(Unknown Source)
	at org.apache.axis.SimpleChain.invoke(Unknown Source)
	at org.apache.axis.server.AxisServer.invoke(Unknown Source)
	at org.apache.axis.transport.http.AxisServlet.doPost(Unknown Source)
	at javax.servlet.http.HttpServlet.service(
	at javax.servlet.http.HttpServlet.service(
	at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
	at org.apache.tomcat.core.Handler.invoke(Unknown Source)
	at org.apache.tomcat.core.Handler.service(Unknown Source)
	at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
	at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
	at org.apache.tomcat.core.ContextManager.service(Unknown Source)
	at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
	at Source)
	at org.apache.tomcat.util.threads.ThreadPool$ Source)

** When the client invokes the service, and an exception is thrown, it
   is handed back an instance of the server-side exception,

Any ideas?

- Bob

SynXis Corporation      |    | Obstacles are those frightful 
1610 Wynkoop, Suite 400 | Ph: (303)595-2511 | things you see when you take your
Denver, CO  80202       | Fax:(303)534-4257 | eyes off your goal.  -Henry Ford

View raw message