Hi Everyone,

This is a followup to my previous mail. Has anyone tried out using
<faultFlow> in the <service> definitions. If yes, can you provide me with
the WSDD syntax for the same. I am using nightly build of Feb 21, 2002.

Thanks,
Romin.

-----Original Message-----
From: Romin Irani [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 21, 2002 1:09 PM
To: Axis
Subject: Fault Flow Issues



I am testing out the Fault Flow in AXIS. Before I get into some of my
questions, let me describe what I am doing:

a) I have simple HelloWorld RPC Service:

package com.myclasses;
public class HelloWorld {

     public String sayHelloWorld(String name) throws Exception {
      return "Hello World to " + name;
    }
}

b) I have defined the following handlers that intercept the request flow and
response flow. The WSDD file for HelloWorld Service is shown below:

<deployment name="HelloWorldService"
xmlns="http://xml.apache.org/axis/wsdd/";
            xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>
            xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance";>

<!-- Define TWO Request Handlers (Handler1 and Handler3)-->
<handler name="Handler1" type="java:com.myclasses.Handler1">
  <parameter name="logfilename" value="d:\\fault.log"/>
</handler>

<handler name="Handler3" type="java:com.myclasses.Handler3">
  <parameter name="logfilename" value="d:\\fault.log"/>
</handler>

<!-- Define ONE Response Handler (Handler2) -->
<handler name="Handler2" type="java:com.myclasses.Handler2">
  <parameter name="logfilename" value="d:\\fault.log"/>
</handler>

<!-- Define the Service (HelloWorld) -->
<service name="HelloWorld" provider="java:RPC">
<requestFlow>
<handler type="Handler1"/>
<handler type="Handler3"/>
</requestFlow>
<responseFlow>
<handler type="Handler2"/>
</responseFlow>
<parameter name="className" value="com.myclasses.HelloWorld"/>
<parameter name="allowedMethods" value="sayHelloWorld"/>
</service>
</deployment>

c) In each of the Handler classes, I have implemented the
invoke(MessageContext ctx) and ofcourse the subject of this email : public
void onFault(MessageContext ctx)

In each Handlers, onFault, I have logged a string that indicates that the
onFault of the specific handler was called.

d) When I intentionally throw an AxisFault in Handler [Response Handler]:
the Response Handler, the onFault()'s are called in this sequence:
 onFault() of Handler3
 onFault() of Handler1

 which is correct, since it gets called in the reverse order of invocation
and ofcourse the Exception handler of Handler3 should take care of its own
cleanup

e) When I intentionally throw an Exception in the Service Code, i.e.
HelloWorld class, the onFault()'s get called in the correct sequence too as
above

f) How do I define a faultFlow for my HelloWorld Service, such that it
invokes a specific chain of handlers. For e.g. I added the following element
to the <service> element in the WSDD above:
<faultFlow>
<handler type="SendEmailHandler" />
</faultFlow>

NOTE: I added a <handler> element for the "SendEmailHandler" in the WSDD
too.

and when I deployed it, the AdminClient did not give any errors, but it did
not add the <faultFlow> element into the server-config.wsdd file. When I
forcefully edited the file with the element, it gave a ServerException i.e.
SimpleChain , addHandler .. failed.

So, my questions are the following:
1. How do I add a faultFlow to my service? What is the correct WSDD syntax
for it ?

2. Can I specify that for all Server exceptions, execute a specific
faultFlow, etc.. so basically can we categorize faults and provide different
fault Flows for the category that the Error belongs to ?

3. What are some of the best practices to follow in the onFault() method of
a handler. Since the method signature is

public void onFault(MessageContext msgContext),

what if I have an exception in this onFault() method ??? What happens in
that case ?

4. When AXIS executes a FaultFlow Chain, will it invoke the onFault()
methods of the that were processed prior to the Fault occuring OR does it
just execute the FaultFlow Chain?

Any pointers on the above would be helpful !! Especially, what is the
correct syntax for defining faultFlows in the WSDD for the <service>
element?

Thanks
<CARD NAME="Romin Irani" EMAIL="[EMAIL PROTECTED]"/>

Reply via email to