This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Web Services and the fly likes how to throw and catch SOAP Fault in Axis2? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "how to throw and catch SOAP Fault in Axis2?" Watch "how to throw and catch SOAP Fault in Axis2?" New topic
Author

how to throw and catch SOAP Fault in Axis2?

J Jensen
Greenhorn

Joined: Dec 19, 2007
Posts: 1
Hello

I am just trying to throw and catch a SOAP Fault (well, AxisFault) from a simple Axis2 web service.
The Axis2-1.3 distribution comes with a faulthanding example, but it seems rather complicated and has lots of auto generated classes. I am sure it is simpler than that.

Let's take the StockQuoteService example, in axis2-1.3\samples\quickstart. The client sends a string like "WSO" and the service returns a quote like "123.23". I'd like to send in the string "XYZ" and get the service to throw an AxisFault with a message, and the client catches it.

So what would I need to do? I'm guessing:

1. Modify StockQuoteService.java to have something like:
if( symbol.equals("XYZ")) throw
new AxisFault( new QName("http://test.org", "FaultCode", "test"),
"FaultReason",
new Exception("This is a test Exception"));

2. Put something in services.xml, but what??

3. Put a catch block in the client code
catch( AxisFault af)
{
af.getMessage();
}

Any help would be appreciated!
--Jeff
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: how to throw and catch SOAP Fault in Axis2?
 
Similar Threads
Web Service Client: Can't read fault instead an IOException is read.
Soap Fault Implementation
Problem with Custom Exceptions in my Axis webservice
Axis2 asynchronous communication
soapfaultexception