BookStore Project
BookStore Project
Project name: Book Store Web Application using JAVA Web services Time: 15 days
Book store: A book Store wants to expose all the information about the books available with them
through a web application.
Prepare a java web service [BookService.java
[ (Service)] to expose the data.(Service)
.(Service)
For the book store you need to prepare a jsp application which uses a java web service.
service.(Client)
The steps you will take to produce and test your project using web services are as follows:
1. Create a project in the Eclipse workspace of type 'Dynamic Web Project', which will host your
web service.
2. Write the Java code (the 'business logic') that implements your web service functionality.
3. Use Eclipse to automatically generate the components (WSDL
(WSDL etc.) that will transform the Java
code into a web service.
4. Create another project of type 'Dynamic Web Project', which will host the client application that
you will use to access and test the web service.
5. Use Eclipse to automatically generate a client
clie interface to call the web service.
6. Use the jsp client to send requests to the web service to have a web application as follows.
BookService.java (Service)
Data for book store
package com.wolkite.se.lab;
if(i>=author.length)
return "no book with the author";
else
return book[i];
}
if(i>=book.length)
return "no author with the book";
else
return author[i];
}
if(i>=book.length)
return 0;
else
return price[i];
}
}
<%@page import="java.util.*"%>
<%@page import="java.rmi.RemoteException"%>
<%@page import="com.wolkite.se.lab.*" %>
<%
java.net.URL endpointUrl=new
java.net.URL("http://localhost:8080/BookStoreService/services/BookService");
org.apache.axis.client.Service service=new org.apache.axis.client.Service();
BookServiceSoapBindingStub stub=new BookServiceSoapBindingStub(endpointUrl,service);
String bname=request.getParameter("value1");
if(bname!=null)
{
String result=stub.getAuthor(bname);
%>
The Author name is: <%=result%>
<%} %>
</body>
</html>
<h1>Book Store</h1>
<%@page import="java.util.*"%>
<%@page import="java.rmi.RemoteException"%>
<%@page import="com.wolkite.se.lab.*" %>
<%
java.net.URL endpointUrl=new
java.net.URL("http://localhost:8080/BookStoreService/services/BookService");
org.apache.axis.client.Service service=new org.apache.axis.client.Service();
BookServiceSoapBindingStub stub=new BookServiceSoapBindingStub(endpointUrl,service);
String[] result=stub.getAllBook();
int i=0;
%>
<table border=1>
<tr><th>All Books</th></tr>
<%
for(;i<result.length;i++)
{
%> <tr><td>
<%=result[i]%> </td>
<%} %></table>
</body>
</html>