Download presentation
Presentation is loading. Please wait.
1
Distributed Web Software Presentation-based, e.g., dynamic web pages Service-based – Web Services
2
Without Web Service Layer: Content and Presentation mixed Database ADatabase BDatabase CDatabase D Servlet html
3
Web Services: Aggregators Database A Database BDatabase C Database D Service B Service A Service C Service D Aggregator Servlet html
4
View How You Want Database Service
5
View How You Want, Examples Show Google Scholar as a graph Various Bookstores using Amazon
6
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.”
7
Sample Web Service: The Google API http://images.google.com/apis/ http://images.google.com/apis/ Your Java/.Net program can call Google functions. SOAP underneath the hood Let’s try it…
8
Google API Tutorial Download at http://images.google.com/apis/http://images.google.com/apis/ 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.
9
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.
10
Google API Assignment Write a class USFInward with a main program that lists the URLs (only) of five web pages that point to www.usfca.edu.www.usfca.edu Instead of beginning from scratch, modify GoogleAPIDemo.java.
11
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
12
Google Solution Issues Define a private static final int MAX=5 Search string should be “linkto:www.usfca.edu” Use GoogleSearchResult.getResults() to get array, then loop on each GoogleSearchResultElement calling getURL()
13
Google Web Service: Under the Hood Google DB SOAP API Java APIC# API Java ClientC# ClientOther Client Google Crawler
14
Amazon Web Service http://associates.amazon.com/exec /panama/associates/ntg/browse/- /1067662/086-3054474-4553435
15
UDDI Registries
16
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.
17
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; }
18
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.