Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
CSG Mini-Workshop: Web Services Justin Tilton instructional media + magic, inc. As presented at the Common Solutions Group Meeting May 9, 2002 Chicago, Illinois JA-SIG Workshop Series Overview • Data XML • Validation Schema • Transport SOAP • Security SAML • Description WSDL • Directory UDDI • Transformation XSLT Data: XML Overview JA-SIG Workshop Series XML is for structuring data [1] • Structured data includes things like: • spreadsheets, address books, configuration parameters, financial transactions, and technical drawings • XML is a set of rules for designing text formats that let you structure your data. • XML is not a programming language, and you don't have to be a programmer to use it or learn it JA-SIG Workshop Series XML is for structuring data [2] • XML makes it easier for a computer to generate data, read data, and ensure that the data structure is unambiguous • XML avoids common pitfalls in language design: • it is extensible • it is platform-independent • and it supports internationalization and localization JA-SIG Workshop Series XML is a family of technologies [1] • XML 1.0 is the specification that defines what "tags" and "attributes" are • Xlink describes a standard way to add hyperlinks to an XML file • XPointer and XFragments are syntaxes in development for pointing to parts of an XML document • XSL is the advanced language for expressing style sheets. It is based on XSLT JA-SIG Workshop Series XML is a family of technologies [2] • XSLT is a transformation language used for rearranging, adding and deleting tags and attributes • XPath is a language for navigating in an XML document • XML Schemas help developers to precisely define the structures of their own XML-based formats. • XQuery provides flexible query facilities to extract data from real and virtual documents on the Web • XML Signatures provide integrity, message authentication, and signer authentication services for an XML document JA-SIG Workshop Series XML is new, but not that new • Development of XML started in 1996 and has been a W3C Recommendation since February 1998 • Before XML there was SGML, developed in the early '80s, and widely used for large documentation projects • The development of HTML started in 1990. • The designers of XML simply took the best parts of SGML, guided by the experience with HTML, and produced something very powerful JA-SIG Workshop Series HTML and XHTML • The successor to HTML is XHTML • XHTML has almost all of the same elements as HTML, but the syntax has been changed slightly to conform to the rules of XML • XHTML allows "<p>", but not "<r>" since <p> is defined in XHTML and <r> is not • XHTML says that "<p>" stands for "paragraph", and not for "price", "person", or anything else • Emerging applications such as uPortal are using XHTML to output content to browsers JA-SIG Workshop Series XML has namespaces • To eliminate name confusion when combining documents, XML provides a namespace mechanism • XSL and RDF are good examples of XMLbased formats that use namespaces • XML Schema is designed to support modularity by defining XML document structures, making it easy to combine two schemas to produce a merged document structure. JA-SIG Workshop Series XML is license-free • XML is license-free, platformindependent and well-supported • A large and growing community of tools and engineers experienced in the technology • Since XML is license-free, you can build your own software around it without fees JA-SIG Workshop Series An example of XML [element] <?xml version="1.0"?> <breakfast_menu> <food> <name>Belgian Waffles</name> <price> <amount>5.95</amount> <currency>US Dollars</currency> </price> <description>two of our famous Belgian Waffles with plenty of real maple syrup</description> <calories>650</calories> </food> <food> <name>Strawberry Belgian Waffles</name> <price> <amount>7.95</amount> <currency>US Dollars</currency> </price> <description>light Belgian waffles covered with strawberries and whipped cream</description> <calories>900</calories> </food> </breakfast_menu> JA-SIG Workshop Series An example of XML [attribute] <?xml version="1.0"?> <breakfast_menu> <food> <name>Belgian Waffles</name> <price currency="US Dollars">5.95</price> <description>two of our famous Belgian Waffles with plenty of real maple syrup</description> <calories>650</calories> </food> <food> <name>Strawberry Belgian Waffles</name> <price currency="US Dollars">7.95</price> <description>light Belgian waffles covered with strawberries and whipped cream</description> <calories>900</calories> </food> </breakfast_menu> Validation: XML Schema Overview JA-SIG Workshop Series What is an XML Schema? • XML Schema is an XML based alternative to Document Type Definition (DTD) • The purpose of an XML Schema is to define the legal building blocks of an XML document, just like a DTD. JA-SIG Workshop Series An XML Schema defines: • Elements and attributes that can appear in a document • Simple child-parent element relationships • The sequence in which the child elements can appear • The number of child elements • Whether an element is empty or can include text • Data types for elements and attributes • Default values for elements and attributes JA-SIG Workshop Series XML Schemas replacing DTDs • We think that very soon XML Schemas will be used in most Web applications as a replacement for DTDs. Here are some reasons: • XML Schemas are richer than DTDs • XML Schemas are written in XML • XML Schemas support data types • XML Schemas support namespaces • XML Schemas are extensible to future additions JA-SIG Workshop Series XML Schema & Data Types • With data type support it is easier to: • Describe permissible document content • Validate the correctness of data • Work with data from a database • Define data facets (restrictions on data) • Define data patterns (data formats) • Convert data between different data types JA-SIG Workshop Series Why Schema is important • A well-formed XML document is a document that conforms to the XML syntax rules • Even if documents are Well-Formed they can still contain errors, and those errors can have serious consequences. • With XML Schemas, most of these errors can be caught by your validating software. XML Schema: Practical JA-SIG Workshop Series The simplest element definition • A schema specifies a set of valid toplevel elements. • In the simplest case, we can define an element to describe a name of the city: Schema: <xsd:element name="city" type="xsd:string"/> Document: <city>Washington</city> JA-SIG Workshop Series Another element definition • A schema specifies a set of valid top-level elements. • Complex types can define elements with children: Schema: <xsd:element name="note"> <xsd:complexType> <xsd:sequence> <xsd:element name="to" type="xsd:string"/> <xsd:element name="from" type="xsd:string"/> <xsd:element name="heading" type="xsd:string"/> <xsd:element name="body" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> JA-SIG Workshop Series Another element definition • A schema specifies a set of valid toplevel elements. • Complex types can define elements with children: Document: <note> <to>Sam</to> <from>Jack</from> <heading>Your presentation</heading> <body>Please update section II</body> </note> Transport: SOAP Overview JA-SIG Workshop Series What is SOAP? • SOAP is an XML based protocol to let software components and applications communicate using standard Internet HTTP • SOAP stands for Simple Object Access Protocol JA-SIG Workshop Series SOAP is: • A communication protocol • For communication between applications • A format for sending messages • Designed to communicate via internet • Platform independent • Language independent • Based on XML • Simple and extensible • Remote procedure call protocol • SOAP will be developed as a W3C standard JA-SIG Workshop Series Why SOAP? • SOAP is Transport Protocol independent • Transport protocol chosen according to network architecture and type of exchange • Real time over the internet might use HTTP, where a batch processing application might use SMTP • SOAP provides a way to communicate between applications running on different operating systems, with different technologies and different programming languages JA-SIG Workshop Series SOAP was Proposed • UserLand, Ariba, Commerce One, Compaq, Developmentor, HP, IBM, IONA, Lotus, Microsoft, and SAP proposed SOAP to W3C, in May 2000 • The ebXML Plenary voted on 16 February 2001 to use SOAP 1.1 and SOAP With Attachments as part of the ebXML transport specification • Anyone using the transport portion of ebXML will therefore be using SOAP JA-SIG Workshop Series SOAP Building Blocks • A SOAP message is an ordinary XML document. • The XML document contains the following XML elements: • A SOAP envelope, that defines the content of the message • A SOAP header (optional), that contains header information such as credentials • A SOAP body, that contains request and response information JA-SIG Workshop Series Syntax Rules • A SOAP message: • Must be encoded using XML • Must have a SOAP envelope • Can have a SOAP header • Must have a SOAP body • Must use the SOAP envelope namespaces • Must use the SOAP encoding namespace • Must NOT contain a DTD reference • Must NOT contain XML processing instructions JA-SIG Workshop Series SOAP Request Example <soap:Envelope> <soap:Body> <GetPrice> <Item>Apples</Item> </GetPrice> </soap:Body> </soap:Envelope> JA-SIG Workshop Series SOAP Template <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/“ soap:encodingStyle= "http://schemas.xmlsoap.org/soap/encoding/"> <soap:Header>…</soap:Header> <soap:Body>…</soap:Body> <soap:Fault>…</soap:Fault> </soap:Envelope> JA-SIG Workshop Series The Envelope Element • The <Envelope> element must be the root element of a SOAP message • It defines the XML document as a SOAP message. JA-SIG Workshop Series The Header Element • The <Header> element can contain additional, application specific information about the SOAP message • For example, the Header element can contain information about the language and currency values used in the SOAP message • Optionally, the header can carry authorization & authentication information JA-SIG Workshop Series The Body Element • The <Body> must be present in a SOAP message • It contains the actual SOAP message or “payload” JA-SIG Workshop Series A SOAP Example [1] • The SOAP request: <soap:Envelope> <soap:Body> <xmlns:m="http://www.stock.org/stock" /> <m:GetStockPrice> <m:StockName>IBM</m:StockName> </m:GetStockPrice> </soap:Body> </soap:Envelope> JA-SIG Workshop Series A SOAP Example [2] • The SOAP response: <soap:Envelope> <soap:Body> <xmlns:m="http://www.stock.org/stock" /> <m:GetStockPriceResponse> <m:Price>34.5</m:Price> </m:GetStockPriceResponse> </soap:Body> </soap:Envelope> JA-SIG Workshop Series SAML Assertion <SAML> <AssertionID> http://www.bizexchange.test/assertion/AE0221 </AssertionID> <Issuer> URN:dns-date:www.bizexchange.test:2001-01-03:19283 </Issuer> <Conditions> <Audience> http://www.bizexchange.test/rule_book.html </Audience> </Conditions> <Subject> <Account>Alice</Account> </Subject> <Resources> <string>http://www.elsevier.com/Journal_X/</string> <string>https://www.SantaMariaUniversity.edu/SIS/</string> </Resources> </SAML> JA-SIG Workshop Series Building web services • Web services architecture overview Web service requestor 3 bind 4 2 find UDDI Service look up web service call Call Web Service Retrieve WSDL Definition 1 publish Register Web Service (at development time) Web service provider WSDL Document JA-SIG Workshop Series WSDL • Web Services Description Language • Language describing what services are available and how they can be accessed • Messages being sent • End-points for message processing • WSDL makes it easy for client applications to use a web sevice JA-SIG Workshop Series WSDL • WSDL document structure <definitions> root element <types/> data type definitions <message/> abstract message definitions <portType/> set of abstract operations <binding/> protocols for a portType <service> grouping of related ports <port/> </service> </definitions> network address for a binding JA-SIG Workshop Series UDDI • Universal Description, Discovery and Integration • A web services registry system • White pages – general information • Yellow pages – service classifications • Green pages – operation rules JA-SIG Workshop Series UDDI: Registry organization businessEntity keyedReference tModelKey keyName keyValue businessKey name URL description contacts businessServices identifierBag categoryBag contact phone address e-mail businessService keyedReference tModelKey keyName keyValue serviceKey tModelKey name description bindingTemplates JA-SIG Workshop Series UDDI: SOAP API • Registry API • Find methods • Inquiry API • Save methods • find_business • save_business • find_service • save_service • find_binding • save_binding • find_tModel • save_tModel • Get methods • Delete methods • get_businessDetail • delete_business • get_serviceDetail • delete_service • get_bindingDetail • delete_binding • get_tModelDetail • delete_tModel The Meteor Channel: an example of Web services JA-SIG Workshop Series Meteor in a nutshell… Lender XML JA-SIG Workshop Series Diagram of Meteor Concept Web Services HTML Student Meteor XML Access Provider Data Provider JA-SIG Workshop Series As implemented ... Web Services Meteor Secure HTML Standard Browser Secure XML uPortal Meteor SOAP Meteor SOAP Database JA-SIG Workshop Series Data from multiple sources, locations JA-SIG Workshop Series Meteor Channel in the uPortal The End Justin Tilton [email protected]