You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2006/10/30 12:03:38 UTC

svn commit: r469118 - in /webservices/axis2/branches/java/1_1/modules/samples/FaultHandling: build.xml docs/ReadMe.html service/src/ service/src/example/ service/src/example/BankServiceSkeleton.java

Author: chinthaka
Date: Mon Oct 30 03:03:36 2006
New Revision: 469118

URL: http://svn.apache.org/viewvc?view=rev&rev=469118
Log:
Making the Fault handling sample to work in two steps. Changed the scripts to create the completed service archive file. Need to handle the client side next.

Added:
    webservices/axis2/branches/java/1_1/modules/samples/FaultHandling/service/src/
    webservices/axis2/branches/java/1_1/modules/samples/FaultHandling/service/src/example/
    webservices/axis2/branches/java/1_1/modules/samples/FaultHandling/service/src/example/BankServiceSkeleton.java
Modified:
    webservices/axis2/branches/java/1_1/modules/samples/FaultHandling/build.xml
    webservices/axis2/branches/java/1_1/modules/samples/FaultHandling/docs/ReadMe.html

Modified: webservices/axis2/branches/java/1_1/modules/samples/FaultHandling/build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/FaultHandling/build.xml?view=diff&rev=469118&r1=469117&r2=469118
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/FaultHandling/build.xml (original)
+++ webservices/axis2/branches/java/1_1/modules/samples/FaultHandling/build.xml Mon Oct 30 03:03:36 2006
@@ -1,23 +1,17 @@
-<project basedir=".">
+<project basedir="." default="generate.service">
 
     <property environment="env"/>
 
-    <target name="check.dependency" unless="env.AXIS2_HOME">
-        <echo message="AXIS2_HOME must be set"/>
-    </target>
-
-    <!-- Generate the service classes from the WSDL. -->
-    <target name="generate.service" if="env.AXIS2_HOME" depends="check.dependency">
-        <ant dir="service"/>
-    </target>
+    <property name="wsdl.uri" value="bank.wsdl"/>
+    <property name="target" value="target"/>
 
     <!-- Build the service, then the client. -->
-    <target name="jar" if="env.AXIS2_HOME" depends="check.dependency">
+    <target name="jar">
         <ant dir="service" target="jar.server"/>
         <ant dir="client"/>
     </target>
 
-    <target name="run">
+    <target name="client">
         <java classname="example.BankClient" fork="true">
             <arg line="${url} ${account} ${amt}"/>
             <classpath>
@@ -27,5 +21,52 @@
                 </fileset>
             </classpath>
         </java>
+    </target>
+
+    <target name="generate.service">
+
+        <delete dir="${target}"/>
+        <mkdir dir="${target}"/>
+        <mkdir dir="${target}/classes"/>
+        
+        <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
+            <arg line="-uri ${wsdl.uri}"/>
+            <arg line="-ss"/>
+            <arg line="-sd"/>
+            <arg line="-o ${target}"/>
+            <!-- Output directory in which to generate files --> <!-- NB it generates to the src folder under this directory!! -->
+            <classpath>
+                <fileset dir="../../lib">
+                    <include name="*.jar"/>
+                </fileset>
+            </classpath>
+        </java>
+
+        <!--copy the already written skeleton class-->
+        <copy file="service/src/example/BankServiceSkeleton.java" todir="${target}/src/example"
+              overwrite="yes"/>
+
+        <!--First let's compile the classes-->
+        <javac debug="on" memoryMaximumSize="256m" memoryInitialSize="256m" fork="true"
+               destdir="${target}/classes" srcdir="${target}/src">
+            <classpath>
+                <fileset dir="../../lib">
+                    <include name="*.jar"/>
+                </fileset>
+            </classpath>
+        </javac>
+
+        <!--aar them up -->
+        <copy toDir="${target}/classes/META-INF" failonerror="false">
+            <fileset dir="${target}/resources">
+                <include name="*.xml"/>
+                <include name="*.wsdl"/>
+                <include name="*.xsd"/>
+            </fileset>
+        </copy>
+        <jar destfile="BankService.aar">
+            <fileset excludes="**/Test.class" dir="${target}/classes"/>
+        </jar>
+
     </target>
 </project>

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=469118&r1=469117&r2=469118
==============================================================================
--- 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 Mon Oct 30 03:03:36 2006
@@ -98,15 +98,15 @@
 		You need to supply 3 parameters to the command, url, account and amount.
 		<ul>
 			<li>
-					<strong>ant run -Durl=http://localhost:8080/axis2/services/BankService -Daccount=13 -Damt=400</strong><br/>
+					<strong>ant 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/>&nbsp;
 			</li>
 			<li>
-					<strong>ant run -Durl=http://localhost:8080/axis2/services/BankService -Daccount=88 -Damt=1200</strong><br/>
+					<strong>ant 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/>&nbsp;
 			</li>
 			<li>
-					<strong>ant run -Durl=http://localhost:8080/axis2/services/BankService -Daccount=88 -Damt=400</strong><br/>
+					<strong>ant 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/>&nbsp;
 			</li>
 		</ul>

Added: webservices/axis2/branches/java/1_1/modules/samples/FaultHandling/service/src/example/BankServiceSkeleton.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/FaultHandling/service/src/example/BankServiceSkeleton.java?view=auto&rev=469118
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/FaultHandling/service/src/example/BankServiceSkeleton.java (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/FaultHandling/service/src/example/BankServiceSkeleton.java Mon Oct 30 03:03:36 2006
@@ -0,0 +1,46 @@
+
+    /**
+     * BankServiceSkeleton.java
+     *
+     */
+    package example;
+    /**
+     *  BankServiceSkeleton java skeleton for the axisService
+     */
+    public class BankServiceSkeleton{
+
+
+        /**
+
+          * @param param0
+
+         */
+        public  example.WithdrawResponse withdraw(example.Withdraw param0)
+           throws InsufficientFundFaultMessageException,AccountNotExistFaultMessageException{
+                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;
+        }
+
+    }
+



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org