Introduction to Web Services

Download Report

Transcript Introduction to Web Services

Computer Science 101
Web Services
Alsos Search for Niels Bohr
AtomicArchive.Com Article on
Niels Bohr
AtomicArchive.Com Article on
Niels Bohr (cont.)
Produces Alsos Search
Alsos Search for Niels Bohr
A specific reference
That’s what they get, not what they
want!

We are providing them with a mechanism,
“dynamic links”, that enable them to do “live”
searches into Alsos – not just link to the Alsos
home page, but …

The user ends up in Alsos site, not Atomic
Archives.

They would like a way to get data (annotations)
from Alsos that they could format within their
pages.
What if we wanted to provide this:

Suppose we wanted to provide a mechanism for
developers to get data from us for use on their
web pages.

We would not want them to access our database
with SQL statements
– Might change database
– Want control of the kind of data we let them have

Would not want to restrict to platform, .NET,
Linux, etc.
What if we wanted to provide this:
(cont.)

We would need a platform independent
means of sharing data

That’s exactly what XML is all about – it’s
text based, marked up data.

Web service – software component that
you call over the web.
– Accepts and returns XML data
The Big Picture

Just like HTML provides a standard way
for marking up text for web page display,
XML provides a standard way for marking
up data.

Web services then provide a standard way
for programs to pass this data back and
forth to each other.
Example – Google Service
Search 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-hits
this.lblHits.set_Text( String.valueOf(result.estimatedTotalResultsCount) );
}
MessageBox.Show("Search complete, first 20 hits are shown!");
Item 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 Service
Stock Ticker
Movie Theaters
Xmethods.net
Movie Service
Movie Service Description
Movie – Code for Find Button
Movie – Code for Theater
Selection
Industry Scenario

Suppose we have a huge industrial
manufacturing company.

The parts we need are supplied by a
number of different suppliers.

At a given time we may prefer one
supplier over the others based on
– Current price they offer
– Adequacy of their inventory relative to our
needs.
Industry Scenario (cont.)

Assuming that all of these suppliers provide
web services for our use, our decision and
purchase could be automated:
– Our inventory/purchasing program could
communicate our needs to all of the supplier
web services and receive their price and
inventory information
– Based on these results, our program could
choose the lowest price among suppliers with
acceptable inventories.