|
Lecture Notes Last Fall Semester 2002 (Notes under development while you can see this.) |
These are likely to be the longest lecture notes of the season though.
This is where your professional life might start, too.
Web Services. A rapidly evolving set of standards and implementation technologies that have great promise for the world of application integration and distributed computing. From our perspective a web service is a platform and implementation independent software component that can be:
Another important point is that a web service's implementation and deployment platform details are not relevant to a program that is invoking the service. A web service is available through its declared API and invocation mechanism (network protocol, data encoding schemes, and so on). This is analogous to the relationship between a web browser and a web application server: very little shared understanding exists between the two components. (The only shared understanding is that they both speak HTTP and converse in HTML or a very limited set of MIME types).
Organizations use web services in two broad categories:
One needs to compare and contrast B2B to B2C.
| Area | B2C application | B2B application |
| Backend logic | Java classes and EJBs | Java classes and EJBs |
| Custom logic | Servlets and EJPs | Web service engine |
| Communication protocol | HTTP | HTTP, SMTP, FTP, TCP/IP, EDI, JMS, RMI/IIOP |
| Data input | HTTP GET/POST parameters | XML |
| Data output | HTML | XML |
| User interface | HTML + script | N/A |
| Client | Human behind a browser | Software application |
Why are web services superior to existing distributed computing approaches?
There are three key reasons.
We should be careful to distinguish and describe the Service Oriented Architecture (SOA).
Any SOA (service oriented architecture) contains three roles:
A service provider is responsible for creating a service decription, publishing that service description to one or more service registries, and receiving web service invocation messages from one or more service requestors. We should describe the other two, also.
Any SOA also includes three operations: publish, find and bind. These operations define the contracts between the SOA roles and we should describe them in greater detail soon, too.
Web services technologies can be factored in the following three stacks:
We now have to start exploring the root of all web services technologies: XML.
Here's a sample purchase order from the Skateboard Warehouse, retailer of skateboards to SkatesTown. The order is for 5 backpacks, 12 skateboards, and 1000 SkatesTown promotional stickers (this is what the stock keeping unit [SKU] of 008-PR stands for).
<po xmlns="http://www.skatestown.com/ns/po" id="50383" submitted="2001-12-06">
<billTo>
<company>The Skateboard Warehouse</company>
<street>One Warehouse Park</street>
<street>Building 17</street>
<city>Boston</city>
<state>MA</state>
<postalCode>01775</postalCode>
</billTo>
<shipTo>
<company>The Skateboard Warehouse</company>
<street>One Warehouse Park</street>
<street>Building 17</street>
<city>Boston</city>
<state>MA</state>
<postalCode>01775</postalCode>
</shipTo>
<order>
<item sku="318-BP" quantity="5">
<description>Skateboard backpack; five pockets</description>
</item>
<item sku="947-TI" quantity="12">
<description>Street-style titanium skateboard.</description>
</item>
<item sku="008-PR" quantity="1000"/>
</order>
</po>
That's the difference between document-centric (HTML-like) XML and data-centric XML. Chapter 2: XML Primer
Introduced in 1998. XML is about structuring, describing, and exchanging information. All key web services technologies are based on it. This chapter will develop a set of examples around SkatesTown's purchase order submission and invoice generation process. Perhaps this is a good time to introduce SkatesTown. SkatesTown is a small but growing business in New York founded by three mechanically inclined friends with a passion for cars and skateboards.
|
|
|
| Larry | Michael | Toni |
They started by designing and selling custom pre-built boards out of Larry's garage, and word soon spread about the quality of their work. They came up with some innovative new construction techniques, and within months they had orders piling up. Now SkatesTown has a small manufacturing operation in Brooklyn, and the company is selling boards, clothing and equipment to stores around the city. Larry, Michael, and Toni couldn't be happier about how their business has grown.
Of the three, Toni is the real gearhead, and he has been responsible for most of the daring construction and design choices that have helped SkatesTown get where it is today. He's the president and head of the team. Michael, gregarious and a smooth talker ever since childhood, now handles marketing and sales. Larry has tightly tracked the computer revolution over the years, and is chief technical officer for the company.
A few years back, Larry realized that networking technology was going to be big, and he wanted to make sure that SkatesTown could catch the wave and utilize distrobuted computing to leverage its business. This focus turned out to be a great move. Larry set up a web presence so SkatesTown could help its customers stay up-to-date without requiring a large staff to answer phones and questions. He also built an online order-processing system to help streamline the actual flow of the business with network-enabled clients. In recent months, more and more stores who carry SkatesTown products have been using the system to great effect.
At present, Larry is pretty happy with the way things are working with SkatesTown's electronic commerce systems. But there have been a few problems, and Larry is sure that things could be even better. He realizes that as the business grows, the manual tasks associated with with order gathering and inventory resupply will limit the company's success. Always one to watch the horizon, Larry has heard the buzz about web services and wants to know more. At the urging of a friend, he got in touch with Al Rosen, a contractor for Silver Bullet Consulting. Silver Bullet specializes in web services solutions, and after a couple of meetings with Al, Larry was convinced - he hired SBC to come in, evaluate SkatesTown's systems, and help the company grow into a web service-enabled business.
|
| Al Rosen |
Work on XML started in 1996. The need was for a simple yet extensible mechanism that would allow the textual representation of structured and semi-structured information. The design inspiration for XML came from two main sources: Standard Generalized Markup Language (SGML) and HTML.
HTML is an SGML application (perhaps the most popular).
XML is a lightweight version of SGML.
The rest of this chapter introduces the set of XML technologies and standards that are the foundation of web services:
Semi-structured marked-up text. The content in these documents is typically meant for human consumption. That's document-centric XML. Here's an example from the FastGlide skateboard user guide:
By contrast, data-centric XML is typically generated by machines and is meant for machine consumption. Consider the purchase order that we presented a few screens above. The use of XML in it is very different from the previous user guide:<h1>Skateboard Usage Requirements</h1> <p>In order to use the <b>FastGlide</b> skateboard you must have:</p> <list> <item>A strong pair of legs.</item> <item>A reasonably long stretch of smooth road surface.</item> <item>The impulse to impress others.</item> </list> <p>If you have all of the above, you can proceed to <link href="Chapter2.xml">Getting on the Board</link>. </p>
class PO {
int id;
Date submitted;
Address billTo, shipTo;
Item order[];
}
Typically, XML documents for human consumption live a long time, whereas some data-centric XML
could live for only a few milliseconds, and that's another relevant difference. Web services are
about data-centric uses of XML, and that's what we are going to focus on in what follows. XML Instances
The structure and formatting of XML in an XML document must follow the rules of the XML instance syntax. XML documents contain an optional prolog followed by a root element that contains the actual document. Typically the prolog serves up to three roles:
A document can be identified as an XML document through the use of a processing instruction. Processing instructions (PIs) are special directives to the application that will process the XML document. In general, data-oriented XML applications do not use application-specific processing instructions. Instead, they tend to put all information in elements and attributes. However, you should use one standard processing instruction: the XML declaration (in the XML document prolog) to determine two very important pieces of information
Here's an example:
The version parameter of the<?xml version="1.0" encoding="UTF-8"?>
xml PI tells the processing application
the version of the XML specification to which the document conforms. Currently, there
is only one version: "1.0". The encoding parameter is optional.
It identifies the character set of the document. The default value is "UTF-8".
If you omit the XML declaration, the XML version is assumed to be 1.0, and the processing
application will try to guess the encoding of the document based on clues (such as the raw
byte order of the data stream). This approach has problems, and whenever interoperability
is of high importance - such as for Web Services - applications should always provide an
explicit XML declaration and use UTF-8 encoding.
Stopped working on this document on Sun Nov 10 21:48:45 EST 2002.
Anticipate coming back to it on Mon Nov 11 2002