Sei sulla pagina 1di 4

SOT SOAP Assignment Report

Timothée CAPALDI

I. One SOAP service which with four methods.

I made a SOAP service for a library inventory. It includes 4 methods:

@WebMethod
public String givelistofbook();
→ Return a list of books (those available at the library) as a string. For example: book1,book2,book3

@WebMethod
public String addbookandgivelist(String addedbook);
→ Add addedbook to previous list of books and return the resulting list as a string. For example, if I
pass book4 as a parameter: book1,book2,book3,book4

@WebMethod
public String removebookandgivelist(String removedbook);
→ Remove removedbook from previous list of books and return the resulting list as a string. For
example, if I pass book2 as a parameter: book1, book3,book4

@WebMethod
public String searchandgivebook(String rearchedbook);
→ Test if searchedbook is part of the list and return searchedbook if it is, or return “unavailable” if it is
not. For example, if I pass book3 as a parameter: book3, if I pass book5 as a parameter: unavailable

II. Service Hosted on Tomcat


I hosted this service on Tomcat as learned on practical 2.
III. WSimport Client
I made a wsimported client to this service using the windows console:

out from client with code calling each methodes one by one:

Source code, client side, class Main:

// get booklist from server


MyBooklistService booklistservice = new MyBooklistService();
Booklist booklist = booklistservice.getMyBooklistPort();

String res=booklist.givelistofbook();
System.out.println("Available books:\n"+res);
res=booklist.addbookandgivelist("book4");
System.out.println("Available books after adding:\n"+res);
res=booklist.searchandgivebook("book1");
System.out.println("Searched book:\n"+res);
res=booklist.removebookandgivelist("book1");
System.out.println("Available books after removing:\n"+res);
res=booklist.searchandgivebook("book1");
System.out.println("Searched book:\n"+res);

IV. Show messages with BURP


I redirected messages sent to 9001 to localhost:8080 (and changed client code accordingly). Below is
BURP http history:

Each post corresponds to one call of a method from the client to the server. BURP detects the status,
length, type of a call and the time it takes to proceed. All these data are available in this table.

V. Homemade Book Class


Books don’t only have names, it also has author! To take this into account, I created a Book class
including two String attributes: name and author:

public class Book {


public String name;
public String author;
}
This modification makes previous Webmethods obsolete. Here are the new ones:

public String giveListOfBook(); => Give a list of all books from the inventory
public void addBook(String name,String author); => add a book to inventory
public void removeBookByTitle(String name); => remove a book by title
public void removeBookById(int id); => remove a book by n°
public String searchBookByTitle(String name); => show availability of a book
public String searchAuthor(String author); => show available book by an author
VI. Real Life example
In real life, my service could be used by my client to manage the library’s inventory. First, the user of the
client would get the list of books available at the moment. Then the user could add books to the list,
remove books from the list by name or by id, search a book by name or search an author to show all his
books. To clarify, I made a user interface.

VII. User Interface


I made a User Interface to the client using JFrame java class. It contains a list of the books available in the
inventory, inputs to add, remove and search books by title, author or Id and a field to show the result of
a research.

Potrebbero piacerti anche