Distributed Web Software Presentation-based, e.g., dynamic web pages Service-based – Web Services
Without Web Service Layer: Content and Presentation mixed Database ADatabase BDatabase CDatabase D Servlet html
Web Services: Aggregators Database A Database BDatabase C Database D Service B Service A Service C Service D Aggregator Servlet html
View How You Want Database Service
View How You Want, Examples Show Google Scholar as a graph Various Bookstores using Amazon
Importance of Web Services Larry Page, on why Google introduced its search API: “Within a few years, there will be more programs (agents) accessing Google than people accessing Google.”
Sample Web Service: The Google API Your Java/.Net program can call Google functions. SOAP underneath the hood Let’s try it…
Google API Tutorial Download at Extract files from zip into directory “Google” Register to get a key (same page). Open the readme file that was downloaded. Run the demo program from “Google” dir: java -cp googleapi.jar com.google.soap.search.GoogleAPIDem o search Foo Where is your registration key and Foo is the item you wish to search for.
Google API Tutorial Check out the Google API Go to javadoc directory and click on index.html API Reference page is “APIs_Reference.html” Check out demo program GoogleAPIDemo.java in main dir. Run it.
Google API Assignment Write a class USFInward with a main program that lists the URLs (only) of five web pages that point to Instead of beginning from scratch, modify GoogleAPIDemo.java.
Google Assignment Solution SaveAs GoogleAPIDemo.java to USFInward.java. Rename class in source file. Replace the package statement at top with: import com.google.soap.search.*; Modify code to perform requested actions. javac -classpath googleapi.jar USFInward.java Add “.” to classpath in execution line: java -cp.;googleapi.jar USFInward.java
Google Solution Issues Define a private static final int MAX=5 Search string should be “linkto: Use GoogleSearchResult.getResults() to get array, then loop on each GoogleSearchResultElement calling getURL()
Google Web Service: Under the Hood Google DB SOAP API Java APIC# API Java ClientC# ClientOther Client Google Crawler
Amazon Web Service /panama/associates/ntg/browse/- / /
UDDI Registries
Writing Web Service Clients in Java WSDL – Web Service Description Language UDDI- Registry of Web Services WSDL wscompile Java stubs 1.Fine Web Service WSDL document in UDDI. 2.Generate Java stubs to access service: 3. Write Java client that accesses service through stubs.
Creating a Web Service Similar to RMI, define a “Remote” interface public interface MathService extends Remote { int add(int x, int y) throws RemoteException; //… } Implement the interface public class MathServiceImpl implements MathService { public int add( int x, int y) throws RemoteException; { return x+y; }
Creating a Web Service (cont.) Use wsdeploy to create “ties” and WSDL file: wsdeploy WSDL Java ties MathService.java MathServiceImpl.java Package and Deploy– Build Web App Resource (WAR) file web.xml descriptor file