310 likes | 452 Views
Chapter 9 Web Services Architecture and XML. Objectives. By study in the chapter, you will be able to: Describe what is the goal of the Web services architecture Conduct the historical review of other technologies before Web services
E N D
Objectives By study in the chapter, you will be able to: • Describe what is the goal of the Web services architecture • Conduct the historical review of other technologies before Web services • Describe why the previous technologies are dissatisfied by the industries • Exam what Web services can provide to allow us to avoid those problems • Exam the major components of the architecture • Describe how to make interactions between components in a Web service
Objectives • Describe the components and structure of XML • Exam the similarity and differences between XML and HTML • Analyze the namespace and schema of XML • Be able to write XML documents • Questions and Discussion • Homework
The goal of the Web services architecture • Is application-to-application communication over the Internet. More specifically, this communication is performed with the idea of facilitating Enterprise Application Integration (EAI) and e-commerce, specially business-to-business e-commerce
Historical review of other technologies before Web services • Web service is not the first attempt to reach the goal described before • There are two major technologies even still available today to that attempt. They are: • CORBA (Common Object Request Broker Architecture) • DCOM (Distributed Component Object Model)
Historical review of other technologies before Web services (continue) • What is CORBA? • Is released in 1991 by OMG (Object Management Group, Inc.) • Is language neutral and designed to work any language • Is using Stub/Skeleton based architecture • Is supported by many third-party vendors • More information about CORBA: • http://www.omg.org/gettingstarted/corbafaq.htm • http://www.corba.org • http://www.cs.indiana.edu/~kksiazek/tuto.html
Historical review of other technologies before Web services (continue) • What is DCOM? • Is released in earlier 1990’s by Microsoft to compete with OMG’s CORBA • Is using stub/skeleton based architecture • It can be built with Visual C++, Visual Basic, C#, and other languages • It only works with Microsoft Windows platforms • More information about DCOM: • http://www.webopedia.com/TERM/D/DCOM.html • http://my.execpc.com/~gopalan/misc/compare.html • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndcom/html/msdn_dcomarch.asp
Why the previous technologies are dissatisfied by the industries • They are not to support asynchronous remote method calls • They are weak in data encoding with binary formats only • Programmer-defined data is not easy to work with CORBA and DCOM • Data validation has to tie with program logic without the separation • They are competing but rarely interoperating
What Web services can promise? • Provides an approach that allow us to avoid many of the problems that CORBA and DCOM suffer from • Supports message-centric asynchronous transactions as well as RPC-style synchronous transactions with equal ease • Emphasizes on application integration and interoperation-ability • Utilizes XML schema for data encoding
What Web services can promise? (continue) • Utilizes XML documents that are human and machine readable and make debugging easier • Utilizes XML to support arbitrary or programmer-defined data by using the WSDL in its description • Separate Data validation from the program logic by adding to any XML document in ease
Major components of the architecture • The following software specifications are considered as components of Web services: • HTTP • HTTP State Management mechanism (cookies) • SOAP • UDDI • WSDL • XML
Major components of the architecture(continue) • HTTP • HyperText Transport Protocol • Current version 1.1 is required in Web services • Purpose of HTTP is to provide communications protocol to move the requests and responses between clients and servers • It’s a popular way to transport SOAP messages between clients and Web services • HTTP may be optional if SOAP 1.2 is used as a component in Web services because other protocols have been added
Major components of the architecture (continue) • HTTP State Management Mechanism (Cookies) • It’s also called as RFC 2965 • It specifies how to create stateful sessions using HTTP requests and responses • It carries three headers’ information between participating clients and services ( ) • More information about RFC 2965 • http://www.faqs.org/rfcs/rfc2965.html
Major components of the architecture (continue) • SOAP (Simple Object Access protocol) • See explanation of the terminology and example in slides of Chapter 6 • We will discuss WSDL in next chapter
Major components of the architecture (continue) • WSDL (Web Services Description Language) • See explanation of the terminology and example in slides of Chapter 6 • We will discuss WSDL in next chapter
Major components of the architecture (continue) • UDDI (Universal Description, Discovery, and Integration) • See explanation of the terminology in slides of Chapter 6 • We will discuss UDDI in next chapter
Major components of the architecture (continue) • XML (eXtensive Markup Language) • We will discuss it next
Introduction to XML • The components of XML • XML document • A file that obeys the rule of XML • XML parser • A software that takes XML as its input and produces a readable representation of its contents • Document Type definition (DTD) • A description of the tags that are allowed in a document and their relationships to each other • The DTD was made obsolete by the publication of the XML schema specification in 2001
Introduction to XML (continue) • XML schema • A description of the tags that are allowed in a document and their relationships to each other • Namespaces • A unique name can be used to avoid conflicts between tags names because a document may contain other XML documents so we must guarantee none tag names are identical to others
Simple Example of XML <?xml version=“1.0”?> <!– xml document declaration --> <SHOWS> <PERFORMANCE> <TITLE>Fairy Princess</TITLE> <AUTHOR/> <DESCRIPTION> Scratch sound with emphasis on color, texture. </DESCRIPTION> <DATE status=“canceled”>04/16/2002</DATE> </PERFORMANCE> </SHOWS> <!-- Note: <AUTHOR/> is an empty tag without data -->
Simple Example of XML (continue) • Execution result in Netscape 6.0: Fairy Princess Scratch sound with emphasis on color, texture. 04/16/2002 • Execution result in Internet Explorer: <?xml version="1.0" ?> <!-- xml document declaration --> - <SHOWS> - <PERFORMANCE> <TITLE>Fairy Princess</TITLE> <AUTHOR /> <DESCRIPTION>Scratch sound with emphasis on color, texture. </DESCRIPTION> <DATE status="canceled">04/16/2002</DATE> </PERFORMANCE> </SHOWS>
XML vs. HTML in syntax • Every XML document must have one root element, i.e.,<shows>…..</shows> • Tags are case-sensitive in XML, but not in HTML • No whitespace is permitted at the beginning of a tag (i.e.,< name> is not allowed), however whitespace at the end of tag is allowed (i.e.,<name > is okay), but not a case in HTML
XML vs. HTML in syntax (continue) • The tag name must start with either a letter or an underscore, but user-defined tags are not allowed in HTML • The tag names may contain any of following: letters, numerals, hyphens, periods, or underscores
XML vs. HTML in syntax (continue) • Each tag must have an end tag, the same as HTML: i.e,<date> …………….</date>, or just an empty tag as <author/>, which is incorrect in HTML • Tags must be nested i.e.,<book>…..<title> …..</book></title> is incorrect, but is okay in HTML • Attribute values must be enclosed in quotes i.e.,date status=canceled is incorrect • Comments use the same HTML syntax i.e.,<!--….comments here….-->
XML Structure • Each XML file starts with an optional prolog: <?xml version=“1.0”?>, or <?xml version=“1.0” encoding=UTF-8” ?>, or <?xml version=“1.0” standalone=“yes” ?> • Each XML file must have one and only one root element • Each XML file may have DTD section or schemas section
Another example of XML file <? Xml version =‘1.0’ encoding = ‘utf-8’ standalone=‘yes’ ?> <!– This XML file represents a request for a cruise ticket -- > <ticketRequest> <customer custID=“1003” <lastName>Carter</lastName> <firstName>Joseph</firstName> </customer> <cruise cruiseID=“3004”> <destination>Hawaii</destination> <port>Honolulu</port> <sailing>7/7/2005</sailing> <numberOfTickets>5</numberOfTickets> </isCommissionable> </cruise> </ticketRequest>
Namespaces in XML • To be able to have unique tag names in an XML file, as namespaces, a prefix string is added before each tag and defined at the beginning of the root tag using a unique URL; for example: <cust:ticketRequest xmlns:cust=‘www.samspulishing.com/customer’ xmlns:boat=‘www.samspublishing.com/boat’>
XML schema and example • Since the DTD did not allow us to specify data types well, W3C has released a new way to specify the legal contents of an XML file called XML schema • In addition, XML schema also allow us to specify the range of values and data types of an element • Example of XML schema for TicketRequest.xml
Homework for Extra Points • Create a simple XML file with at least four tags in which at least two tags with attributes for your college • Create an XML schema file that validates the XML file above Due: Wednesday, June 1, 2005 in the class