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 de...@apache.org on 2008/07/04 13:14:56 UTC
svn commit: r674010 - in
/webservices/axis2/trunk/java/modules/samples/servicelifecycle: README.txt
src/client/LibraryServiceClient.java
src/sample/servicelifecycle/LibraryService.java
Author: deepal
Date: Fri Jul 4 04:14:55 2008
New Revision: 674010
URL: http://svn.apache.org/viewvc?rev=674010&view=rev
Log:
fixing the issue https://issues.apache.org/jira/browse/AXIS2-1698
Modified:
webservices/axis2/trunk/java/modules/samples/servicelifecycle/README.txt
webservices/axis2/trunk/java/modules/samples/servicelifecycle/src/client/LibraryServiceClient.java
webservices/axis2/trunk/java/modules/samples/servicelifecycle/src/sample/servicelifecycle/LibraryService.java
Modified: webservices/axis2/trunk/java/modules/samples/servicelifecycle/README.txt
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/samples/servicelifecycle/README.txt?rev=674010&r1=674009&r2=674010&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/servicelifecycle/README.txt (original)
+++ webservices/axis2/trunk/java/modules/samples/servicelifecycle/README.txt Fri Jul 4 04:14:55 2008
@@ -4,7 +4,7 @@
Introduction:
============
-This sample demonstrate usage of service lifecycle and bit of session managment.
+This sample demonstrate usage of the service lifecycle and a bit of session managment.
The main idea is to show where and how to use service lifecycle interface and
session related methods.
@@ -13,34 +13,44 @@
=============
Apache Ant 1.6.2 or later
-If you want to access the service in REST manner you have to deploy the service in
+If you want to access the service in a REST manner you have to deploy the service in an
application server such as Apache Tomcat. Note that it will not work with axis2server.
-Deploying the Sevrice
+Deploying the Service
=====================
Deploy into Sample repository:
- * Type ant generate.service or simply ant from Axis2_HOME/samples/servicelifecycle
+ * Type ant generate.service or simply ant from AXIS2_HOME/samples/servicelifecycle
Deploy into Tomcat :
* To build and copy the service archive file into Tomcat, type ant copy.to.tomcat from
-Axis2_HOME/samples/servicelifecycle which will copy the aar file into
-tomcat/web-app/axis2/WEB-INF/services directory.
+AXIS2_HOME/samples/servicelifecycle which will copy the aar file into
+<tomcat_home>/web-app/axis2/WEB-INF/services directory.
Running the Client
==================
-Type ant run.client from Axis2_HOME/samples/servicelifecycle.
+Type ant run.client from AXIS2_HOME/samples/servicelifecycle.
And then follow the instructions as mentioned in the console.
+When asked for service epr address, enter
+http://<host>:<port>/axis2/services/Library
+Where <host> & <port> would be the host and port that tomcat is running on, respectively.
+
Advanced Guide
==============
For more details kindly see doc/servicelifecycleguide.html
+Note
+==============
+Sometimes, if you're having trouble running the client successfully,
+It may be necessary to clean the services repository before you generate the service, deploy it
+and run the client. (i.e. delete services created from previous samples.)
+
Help
====
Please contact axis-user list (axis-user@ws.apache.org) if you have any trouble running the sample.
Modified: webservices/axis2/trunk/java/modules/samples/servicelifecycle/src/client/LibraryServiceClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/samples/servicelifecycle/src/client/LibraryServiceClient.java?rev=674010&r1=674009&r2=674010&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/servicelifecycle/src/client/LibraryServiceClient.java (original)
+++ webservices/axis2/trunk/java/modules/samples/servicelifecycle/src/client/LibraryServiceClient.java Fri Jul 4 04:14:55 2008
@@ -41,8 +41,8 @@
client.runClient();
}
- public void runClient() throws Exception {
- System.out.println("=====Welcome to Libraray client======");
+ public void showOptions() {
+ System.out.println("=====Welcome to Libraray client======");
System.out.println(" ");
System.out.println(" To list All books type 1");
System.out.println(" To list Available books type 2");
@@ -54,7 +54,10 @@
System.out.println(" To exit type -1 ");
System.out.println(" ");
System.out.println(" ");
- System.out.println("Enter service epr address : ");
+
+ }
+ public void runClient() throws Exception {
+ System.out.println("Enter service epr address : ");
String epr = getInput();
RPCServiceClient rpcClient = new RPCServiceClient();
Options opts = new Options();
@@ -62,12 +65,20 @@
rpcClient.setOptions(opts);
LibraryServiceClient client = new LibraryServiceClient();
while (true) {
+ showOptions();
System.out.println("Type your command here : ");
String commandsParms = getInput();
if (commandsParms != null) {
String[] args = commandsParms.split(" ");
String firstarg = args[0];
- int command = Integer.parseInt(firstarg);
+ int command;
+ try {
+ command = Integer.parseInt(firstarg);
+ }
+ catch (NumberFormatException e) {
+ System.out.println("Illegal argument entered.\n");
+ continue;
+ }
switch (command) {
case 1 : {
client.listAllBook(rpcClient);
@@ -155,6 +166,10 @@
case -1 : {
System.exit(0);
}
+ default: {
+ System.out.println("Wrong argument.\n");
+ break;
+ }
}
}
}
Modified: webservices/axis2/trunk/java/modules/samples/servicelifecycle/src/sample/servicelifecycle/LibraryService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/samples/servicelifecycle/src/sample/servicelifecycle/LibraryService.java?rev=674010&r1=674009&r2=674010&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/servicelifecycle/src/sample/servicelifecycle/LibraryService.java (original)
+++ webservices/axis2/trunk/java/modules/samples/servicelifecycle/src/sample/servicelifecycle/LibraryService.java Fri Jul 4 04:14:55 2008
@@ -22,6 +22,8 @@
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
+
+import sample.servicelifecycle.LibraryConstants;
import sample.servicelifecycle.bean.Book;
import sample.servicelifecycle.bean.BookList;
import sample.servicelifecycle.bean.User;
@@ -52,7 +54,7 @@
}
public Book lendBook(String isbn, String userName) throws AxisFault {
- if (isLooged(userName)) {
+ if (isLogged(userName)) {
Book book = availableBookList.getBook(isbn);
if (book == null) {
book = lendBookList.getBook(isbn);
@@ -75,7 +77,7 @@
lendBookList.removeBook(tempBook);
}
- private boolean isLooged(String userName) {
+ private boolean isLogged(String userName) {
return userList.isLogged(userName);
}