Computer Science Computer Science 101101
Web ServicesWeb Services
Alsos Search for Niels BohrAlsos Search for Niels Bohr
AtomicArchive.Com Article on AtomicArchive.Com Article on Niels BohrNiels Bohr
AtomicArchive.Com Article on AtomicArchive.Com Article on Niels Bohr (cont.)Niels Bohr (cont.)
Produces Alsos Search
Alsos Search for Niels BohrAlsos Search for Niels Bohr
A specific referenceA specific reference
That’s what they get, not what That’s what they get, not what they want!they want!
We are providing them with a mechanism, We are providing them with a mechanism, “dynamic links”, that enable them to do “live” “dynamic links”, that enable them to do “live” searches into Alsos – not just link to the Alsos searches into Alsos – not just link to the Alsos home page, but …home page, but …
The user ends up in Alsos site, not Atomic The user ends up in Alsos site, not Atomic Archives.Archives.
They would like a way to get data They would like a way to get data (annotations) from Alsos that they could (annotations) from Alsos that they could format within their pages.format within their pages.
What if we wanted to provide What if we wanted to provide this:this:
Suppose we wanted to provide a mechanism Suppose we wanted to provide a mechanism for developers to get data from us for use on for developers to get data from us for use on their web pages.their web pages.
We would not want them to access our We would not want them to access our database with SQL statementsdatabase with SQL statements– Might change databaseMight change database– Want control of the kind of data we let them Want control of the kind of data we let them
havehave
Would not want to restrict to platform, .NET, Would not want to restrict to platform, .NET, Linux, etc.Linux, etc.
What if we wanted to provide What if we wanted to provide this:this:
(cont.)(cont.) We would need a platform We would need a platform
independent means of sharing dataindependent means of sharing data
That’s exactly what XML is all about – That’s exactly what XML is all about – it’s text based, marked up data.it’s text based, marked up data.
Web service – software component Web service – software component that you call over the web.that you call over the web.– Accepts and returns XML dataAccepts and returns XML data
The Big PictureThe Big Picture
Just like HTML provides a standard Just like HTML provides a standard way for marking up text for web way for marking up text for web page display, XML provides a page display, XML provides a standard way for marking up data.standard way for marking up data.
Web services then provide a Web services then provide a standard way for programs to pass standard way for programs to pass this data back and forth to each this data back and forth to each other.other.
Example – Google ServiceExample – Google Service
Search ButtonSearch Button
private void btnSearch_Click (Object sender, System.EventArgs e){
GoogleSearchResult result = null;GoogleSearchService google;ResultElement re;google = new GoogleSearchService();this.lstURLs.get_Items().Clear();for (int i = 0; i < 20; i += 10) // get first 20 hits total{ result = google.doGoogleSearch("4a8/TvZQFHID0WIWnL1CMmMx0sNqhG8H",
this.txtSearch.get_Text(), i, 10, false, "", false, "", "", ""); for (int j = 0; j< result.resultElements.length; j++) {
re = result.resultElements[j];this.lstURLs.get_Items().Add(re.URL);
} this.lstURLs.Refresh();}//for-n-hitsthis.lblHits.set_Text( String.valueOf(result.estimatedTotalResultsCount) );
MessageBox.Show("Search complete, first 20 hits are shown!");}
Item SelectedItem Selected
private void lstURLs_SelectedIndexChanged (Object sender, System.EventArgs e){
java.lang.Object a, b, c, d;a = b = c = d = null; // optional parameters
// navigate to selected site!this.axWebBrowser1.Navigate(this.lstURLs.get_Text(), a, b, c, d);
}
Terra ServiceTerra Service
Stock TickerStock Ticker
Movie TheatersMovie Theaters
Xmethods.netXmethods.net
Movie ServiceMovie Service
Movie Service DescriptionMovie Service Description
Movie – Code for Find Movie – Code for Find ButtonButton
Movie – Code for Theater Movie – Code for Theater SelectionSelection
Industry ScenarioIndustry Scenario
Suppose we have a huge industrial Suppose we have a huge industrial manufacturing company.manufacturing company.
The parts we need are supplied by a The parts we need are supplied by a number of different suppliers.number of different suppliers.
At a given time we may prefer one At a given time we may prefer one supplier over the others based on supplier over the others based on – Current price they offerCurrent price they offer– Adequacy of their inventory relative to our Adequacy of their inventory relative to our
needs.needs.
Industry Scenario (cont.)Industry Scenario (cont.)
Assuming that all of these suppliers Assuming that all of these suppliers provide web services for our use, our provide web services for our use, our decision and purchase could be decision and purchase could be automated:automated:– Our inventory/purchasing program could Our inventory/purchasing program could
communicate our needs to all of the communicate our needs to all of the supplier web services and receive their supplier web services and receive their price and inventory informationprice and inventory information
– Based on these results, our program Based on these results, our program could choose the lowest price among could choose the lowest price among suppliers with acceptable inventories.suppliers with acceptable inventories.