Hi Jeff,

That is my problem, in the generated code, there is a class that is the one
that represents the exception in the server, but never takes the exception,
if it does not go away to a AxisFault. All exception that sends to me in the
generated code, is a AxisFault, and that I do not like, as I solve this?

it is something thus:

public class Test {
   public int getInteger(String cad) throws ErrorDeNumero {
       int res = 0;
       try {
           res = Integer.parseInt(cad);
       }
       catch (NumberFormatException e) {
           throw new ErrorDeNumero("La cadena no es numero valido");
       }
       return res;
   }
}

public class ErrorDeNumero extends AxisFault {

   public ErrorDeNumero(String msg) {
       super(msg);
   }
}
------- services.xml--------
<serviceGroup>
   <service name="Test">
       <parameter name="ServiceClass" locked="XSD:false">
           com.test.service.Test
       </parameter>
       <operation name="getInteger" mep="
http://www.w3.org/2004/08/wsdl/in-out";>
           <messageReceiver class="
org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
       </operation>
       <messageReceivers>
           <messageReceiver
                   mep="http://www.w3.org/2004/08/wsdl/in-only";
                   class="
org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
           <messageReceiver
                   mep="http://www.w3.org/2004/08/wsdl/in-out";
                   class="org.apache.axis2.rpc.receivers.RPCMessageReceiver
"/>
       </messageReceivers>
   </service>
</serviceGroup>


On 2/26/07, Walker, Jeff <[EMAIL PROTECTED]> wrote:

 Jose,
I think exception handling in web services in general is supposed to be
propagated as SOAP Faults (i.e. an xml structure), not actual Java
exceptions. So, you would define a SOAP Fault in the WSDL (or possibly in
some XML Schema) and the WSDL2Java generator would create some Java
exception classes that represent the SOAP Fault on the server-side.

So the process is something like:
1. Web service code on server runs into a bad condition and creates an
object of an exception class that represents a SOAP Fault. (The exception
subclass(s) are generated for you by Axis, or possibly JAXB).
2. Axis marshals the thrown exception into a SOAP Fault for transport
across the wire.
3. Client receives the SOAP Fault and the stub sitting on the client-side
unmarshals it back into an exception subclass the client code can
understand. (The SOAP Fault has some properties that are essentially strings
that describe the problem that happened on the server. When the exception
subclass is instantiated in the client, those strings fields are populated
for you by the stub).

Reply via email to