alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

Sample: Exception Handling using WSDL Faults
==============================================

Introduction
============

This sample demonstrates how exceptions can be handled using WSDL faults, in other words, how to specify a WSDL fault in order to allow your service to communicate exception pathways to your clients. 

Running of this sample assumes that you are running this within the extracted release folder.

Pre-Requisites
==============
Apache Ant 1.6.2 or later


Building The Service
=====================

* Type ant generate.service or just ant from Axis2_HOME/samples/faulthandling.
* Then go to Axis2_HOME/bin directory and run either axis2server.bat or axis2server.sh depending on your platform.

If you go to  http://localhost:8080/axis2/ you should see BankService is deployed. 

Running The Client
==================

Invoke the client/src/example/BankClient.java class. You may use the command scripts to do so. You need to supply 3 parameters to the command- url, account and amount.

 * ant run.client -Durl=http://localhost:8080/axis2/services/BankService -Daccount=13 -Damt=400
   Throws AccountNotExistFaultMessageException. You will see "Account#13 does not exist"  
 * ant run.client -Durl=http://localhost:8080/axis2/services/BankService -Daccount=88 -Damt=1200
   Throws InsufficientFundsFaultMessageException. You will see "Account#88 has balance of 1000. It cannot support withdrawal   of 1200"  
 * ant run.client -Durl=http://localhost:8080/axis2/services/BankService -Daccount=88 -Damt=400
   Succeeds with a balance of 600. You will see "Balance = 600"  

When you call ant run.client with parameters, before running client/src/example/BankClient.java class, it does the following as well:
 * Generate the stubs (for the client) from the WSDL
 * Compile the client classes
 * Create a Jar of the client classes and copy it to build/client/BankService-test-client.jar

Advanced Guide
==============
For more details kindly see doc/FaultHandlingSampleGuide.html

Help
====
Please contact axis-user list (axis-user@ws.apache.org) if you have any trouble running the sample.
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.