You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2006/11/02 09:33:47 UTC
svn commit: r470273 -
/webservices/axis2/branches/java/1_1/modules/samples/faulthandling/docs/ReadMe.html
Author: chatra
Date: Thu Nov 2 00:33:47 2006
New Revision: 470273
URL: http://svn.apache.org/viewvc?view=rev&rev=470273
Log:
in the process of review
Modified:
webservices/axis2/branches/java/1_1/modules/samples/faulthandling/docs/ReadMe.html
Modified: webservices/axis2/branches/java/1_1/modules/samples/faulthandling/docs/ReadMe.html
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/faulthandling/docs/ReadMe.html?view=diff&rev=470273&r1=470272&r2=470273
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/faulthandling/docs/ReadMe.html (original)
+++ webservices/axis2/branches/java/1_1/modules/samples/faulthandling/docs/ReadMe.html Thu Nov 2 00:33:47 2006
@@ -1,142 +1,125 @@
-<head>
- <title>:: Exception Handling using WSDL Faults ::</title>
-</head>
-
-<body>
-<h1>
- Exception Handling using WSDL Faults
-</h1>
-
-<p>
- This example show cases how to specify a WSDL fault in order to allow
- your service to communicate exception pathways to your clients.
-</p>
-
-<p>
- Running of this sample assumes that you are running this within the extracted release folder.
-</p>
-
-<h2>
- Constructing the Service and the Client.
-</h2>
-
-<p>
- The first step is to generate the service skeleton and other interface classes from the WSDL.
-</p>
-
-<p>
- Look at <em>bank.wsdl</em>.
- It defines the interface for our service. Of particular interest are
- the <strong>AccountNotExistFault</strong> and <strong>InsufficientFundFault</strong>
- types defined in the wsdl:types element.
-</p>
-
-<p>
- From a command prompt in the folder of this example,
- type <strong>ant generate.service</strong> or just <strong> ant</strong>. This will:
-<ul>
- <li>Generate the source for all the server classes in <strong>./service/target/src</strong>
- </li>
- <li>Generate <em>services.xml</em> and a more complete <em>BankService.wsdl</em> into
- the <em>./service/target/resources</em> folder.
- </li>
- <li>
- Generate a <em>./service/target/build.xml</em>
- </li>
- <li>Copies the pre-populated service skeleton class to the generated code</li>
- <li>Compile the Java classes for the service</li>
- <li>Create the service archive and copy it to Axis2 repository (repository/services/) as
- sample-faulthandling.aar.</li>
-</ul>
-</p>
-
-<p>
- Open up <em>./service/target/src/example/BankServiceSkeleton.java</em> and
- you will see the following code fragment inside <strong>#withdraw</strong> method. When
- generate.service was being executed, Axis2 generates an empty skeleton class and we replace it
- with a pre-populated skeleton class which has the following code inside it.
-
- <pre>
- final String account = param0.getAccount();
- if (account.equals("13")) {
- final AccountNotExistFault fault = new AccountNotExistFault();
- fault.setAccount(account);
- AccountNotExistFaultMessageException messageException = new AccountNotExistFaultMessageException("Account does
- not exist!");
- messageException.setFaultMessage(fault);
- throw messageException;
- }
-
- final int amount = param0.getAmount();
- if (amount > 1000) {
- final InsufficientFundFault fault = new InsufficientFundFault();
- fault.setAccount(account);
- fault.setBalance(1000);
- fault.setRequestedFund(amount);
- InsufficientFundFaultMessageException messageException = new InsufficientFundFaultMessageException("Insufficient
- funds");
- messageException.setFaultMessage(fault);
- throw messageException;
- }
-
- final WithdrawResponse response = new WithdrawResponse();
- response.setBalance(1000 - amount);
- return response;
- </pre>
-</p>
-
-<p>
- Note that the source generated for the client will include the 2 faults and the local Exceptions
- through which they will be transmitted. Note that the Exceptions are generated within the <em>BankStub</em>
- class.
-</p>
-
-<h2>
- Deploying the Service
-</h2>
-
-<p>
- The above step must have already copied your BankService.aar file in to repository/services/ folder. Then go to bin
- folder and run either of axis2server.bat or axis2server.sh, depending on your platform to startup Axis2 server.
-</p>
-
-<p>With the default configuration, if you go to <a href="http://localhost:8080/axis2/">
- http://localhost:8080/axis2/</a> you should see BankService was deployed. </p>
-
-<h2>
- Running the Client.
-</h2>
-
-<p>
- Invoke the <em>example.BankClient</em> class. You may use the command scripts to do so.
- You need to supply 3 parameters to the command, url, account and amount.
- <ul>
- <li>
- <strong>ant run.client -Durl=http://localhost:8080/axis2/services/BankService -Daccount=13
- -Damt=400</strong><br/>
- Throws AccountNotExistFaultMessageException. You will see "Account#13 does not
- exist"<br/>
- </li>
- <li>
- <strong>ant run.client -Durl=http://localhost:8080/axis2/services/BankService -Daccount=88
- -Damt=1200</strong><br/>
- Throws InsufficientFundsFaultMessageException. You will see "Account#88 has balance of
- 1000. It cannot support withdrawal of 1200"<br/>
- </li>
- <li>
- <strong>ant run.client -Durl=http://localhost:8080/axis2/services/BankService -Daccount=88
- -Damt=400</strong><br/>
- Succeeds with a balance of 600. You will see "Balance = 600"<br/>
- </li>
- </ul>
-
- When you cal ant run.client with parameters, before running example.BankClient class it does the following as well.
-
- <ul>
- <li>Generate the stubs (for the client) from the WSDL</li>
- <li>Compile the client classes</li>
- <li>Create a Jar of the client classes and copy it to <em>./BankService-test-client.jar</em>
- </li>
- </ul>
-</p>
-</body>
\ No newline at end of file
+<html>
+<head>
+ <meta http-equiv="content-type" content="">
+ <title>:: Exception Handling using WSDL Faults ::</title>
+</head>
+
+<body>
+<h1>Exception Handling using WSDL Faults</h1>
+
+<p>This sample demonstrates how to specify a WSDL fault in order to allow
+your service to communicate exception pathways to your clients.</p>
+
+<p>Running of this sample assumes that you are running this within the
+extracted release folder.</p>
+
+<h2>Constructing the Service and Client</h2>
+
+<p>The first step is to generate the service skeleton and other interface
+classes from the WSDL.</p>
+
+<p>Look at <em><a href="../bank.wsdl">bank.wsdl</a></em>. It defines the
+interface for our service. Of particular interest are the
+<strong>AccountNotExistFault</strong> and
+<strong>InsufficientFundFault</strong> types defined in the wsdl:types
+element.</p>
+
+<p>Using a command prompt in the folder of this example, type <strong>ant
+generate.service</strong> or just <strong> ant</strong>. This will:</p>
+<ul>
+ <li>Generate the source for all the service classes in
+ <strong>build/service/src/example</strong></li>
+ <li>Generate <em>services.xml</em> and a more complete
+ <em>BankService.wsdl</em> into the <em>build/service/resources</em>
+ folder.</li>
+ <li>Generate a <em>build/service/build.xml</em></li>
+ <li>Copies the pre-populated service skeleton class to the generated
+ code</li>
+ <li>Compile the Java classes for the service</li>
+ <li>Create the service archive and copy it to Axis2 repository
+ (repository/services/) as sample-faulthandling.aar.</li>
+</ul>
+
+<p>Open up <em>service/src/example/BankServiceSkeleton.java</em> and you will
+see the following code fragment inside <strong>#withdraw</strong> method.
+When generate.service was being executed, Axis2 generates an <span
+style="color: #FF0000">empty</span> skeleton class
+(build/service/src/example/BankServiceSkeleton.java) and we replace it with a
+pre-populated skeleton class (service/src/example/BankServiceSkeleton.java)
+which has the following code inside it.</p>
+<pre> final String account = param0.getAccount();
+ if (account.equals("13")) {
+ final AccountNotExistFault fault = new AccountNotExistFault();
+ fault.setAccount(account);
+ AccountNotExistFaultMessageException messageException = new AccountNotExistFaultMessageException("Account does
+ not exist!");
+ messageException.setFaultMessage(fault);
+ throw messageException;
+ }
+
+ final int amount = param0.getAmount();
+ if (amount > 1000) {
+ final InsufficientFundFault fault = new InsufficientFundFault();
+ fault.setAccount(account);
+ fault.setBalance(1000);
+ fault.setRequestedFund(amount);
+ InsufficientFundFaultMessageException messageException = new InsufficientFundFaultMessageException("Insufficient
+ funds");
+ messageException.setFaultMessage(fault);
+ throw messageException;
+ }
+
+ final WithdrawResponse response = new WithdrawResponse();
+ response.setBalance(1000 - amount);
+ return response;
+ </pre>
+
+<p>Note that the source generated for the client will include the 2 faults
+and the local Exceptions through which they will be transmitted. Note that
+the Exceptions are generated within the <em>BankStub</em> class.</p>
+
+<h2>Deploying the Service</h2>
+
+<p>The above step must have already copied your BankService.aar file in to
+repository/services/ folder. Then go to bin folder and run either of
+axis2server.bat or axis2server.sh, depending on your platform to startup
+Axis2 server.</p>
+
+<p>With the default configuration, if you go to <a
+href="http://localhost:8080/axis2/"> http://localhost:8080/axis2/</a> you
+should see BankService was deployed.</p>
+
+<h2>Running the Client.</h2>
+
+<p>Invoke the <em>client/src/example/BankClient</em>.java class. You may use
+the command scripts to do so. You need to supply 3 parameters to the command,
+url, account and amount.</p>
+<ul>
+ <li><strong>ant run.client
+ -Durl=http://localhost:8080/axis2/services/BankService -Daccount=13
+ -Damt=400</strong><br>
+ Throws AccountNotExistFaultMessageException. You will see "Account#13
+ does not exist"<br>
+ </li>
+ <li><strong>ant run.client
+ -Durl=http://localhost:8080/axis2/services/BankService -Daccount=88
+ -Damt=1200</strong><br>
+ Throws InsufficientFundsFaultMessageException. You will see "Account#88
+ has balance of 1000. It cannot support withdrawal of 1200"<br>
+ </li>
+ <li><strong>ant run.client
+ -Durl=http://localhost:8080/axis2/services/BankService -Daccount=88
+ -Damt=400</strong><br>
+ Succeeds with a balance of 600. You will see "Balance = 600"<br>
+ </li>
+</ul>
+When you call ant run.client with parameters, before running
+client/src/example/BankClient.java class it does the following as well.
+<ul>
+ <li>Generate the stubs (for the client) from the WSDL</li>
+ <li>Compile the client classes</li>
+ <li>Create a Jar of the client classes and copy it to
+ <em>build/client/BankService-test-client.jar</em></li>
+</ul>
+</body>
+</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org