370 likes | 473 Views
Technologies of the Networked Organization: XML & Web Services. Prof. Jonathan Wareham j.wareham@esade.edu. Structuring Web Documents: Cascading Style Sheets & XML. Structured Formatting Introduction to CCS Structured Web Document Introduction to XML. Data stream in a typical interface….
E N D
Technologies of the Networked Organization:XML & Web Services Prof. Jonathan Wareham j.wareham@esade.edu
Structuring Web Documents:Cascading Style Sheets & XML Structured Formatting Introduction to CCS Structured Web Document Introduction to XML
Data stream in a typical interface… “ABC47-Z”, “100”, “STL”, “C”, “3”, “28” Same data stream in XML… <INVENTORY> <PART_NUM>ABC47-Z</PART_NUM> <QUANTITY>100</QUANTITY> <WAREHOUSE>STL</WAREHOUSE> <ZONE>C</ZONE> <AISLE>3</AISLE> <BIN>28</BIN> </INVENTORY> Example: Self-describing data
What’s so great about XML? • The data is self-describing • The meaning of the data is included: identifiers surround every bit of data, indicating what it means • Far more flexible method of representing transmitted information • Batched orders sent together can have different fields and format without breaking apps on each end • Open, standard technologies for moving, processing and validating the data • The XML parser built into IE5 can automatically parse, validate, and feed the information to an application, instead of every application having to include this functionality
XML • eXtensible Markup Language • Defines data • Improved “CSV” format • Recordset (Rows & Columns) • Data can be hierarchical • Each file can contain multiple record sets • See customer.xml
Explanation - DTD • This example defines the following document tree structure: COURSELIST STUDENT FIRSTNAME LASTNAME CLASSNAME
A XML Document Example <?xml Version=“1.0” Encoding=“UTF-8”?> <!DOCTYPE simple [ <!ELEMENT COURSELIST(STUDENT,CLASSNAME+)> <!ELEMENT STUDENT (FIRSTNAME,LASTNAME)> <!ELEMENT FIRSTNAME (#PCDATA)> <!ELEMENT LASTNAME (#PCDATA)> <!ELEMENT CLASSNAME (#PCDATA)> <!ELEMENT description “This is a very simple example”> ]> <COURSELIST> <STUDENT> <FIRSTNAME> Susan </ FIRSTNAME > <LASTNAME> Glass </ LASTNAME > </STUDENT > <CLASSNAME> CIS 8110 Intro. To IS </CLASSNAME> </ COURSELIST>
A XML Document Example <COURSELIST> <STUDENT> <FIRSTNAME> Jeo </ FIRSTNAME > <LASTNAME> Suess </ LASTNAME > </STUDENT > <CLASSNAME> CIS 8110 Intro. To IS </CLASSNAME> <CLASSNAME> CIS 8120 OO Prototyping </CLASSNAME> <CLASSNAME> CIS 8140 Intro. To DBMS </CLASSNAME> </ COURSELIST> < COURSELIST> <STUDENT> <FIRSTNAME> John </ FIRSTNAME > <LASTNAME> Smith </ LASTNAME > </STUDENT > <CLASSNAME> CIS 8110 Intro. To IS </CLASSNAME> <CLASSNAME> CIS 8140 Intro. To DBMS </CLASSNAME> </ COURSELIST>
DTD • Document Type Definition • Defines structure of an XML document • Can be defined within XML or linked in • <!DOCTYPE books SYSTEM “books.dtd”> • <!DOCTYPE books SYSTEM http://wareham.eci.gsu/xmlcases/books.dtd”> • DTDs still difficult to read and program XML schemas on the way from http://www.w3.org/tr/ • XML schemas USE XML syntax, not EBNF
Using DTD and XML Documents DTD <!DOCTYPE books [ <!ELEMENT books (book)*> DTD <!DOCTYPE books [ <!ELEMENT books (book)*> XML XML
What’s Missing in DTDs? • Cannot manipulate ‘DTD’s like XML documents • Syntax different from XML documents • Lack of data typing • XSL: Schemas • Data Typing • Open/Closed Models • Can use XML tools with XML schemas
An Example Schema <?xml version = "1.0"?> <!-- Microsoft XML Schema showing the ElementType --> <Schema xmlns = "urn:schemas-microsoft-com:xml-data"> <ElementType name = "message" content = "textOnly" model = "closed"> <description>Text messages</description> </ElementType> <ElementType name = "greeting" model = "closed“ content = "mixed" order = "many"> <element type = "message"/> </ElementType> <ElementType name = "myMessage" model = "closed“ content = "eltOnly" order = "seq"> <element type = "greeting" minOccurs = "0“ maxOccurs = "1"/> <element type = "message" minOccurs = "1" maxOccurs = "*"/> </ElementType> </Schema>
Data Types in Schemas <?xml version = "1.0"?> <Schema xmlns = "urn:schemas-microsoft-com:xml-data" xmlns:dt = "urn:schemas-microsoft-com:datatypes"> <ElementType name = "inventory" content = "eltOnly" model = "closed"> <element type = "book" minOccurs = "0" maxOccurs = "*"/> </ElementType> <ElementType name = "book" content = "eltOnly" order = "seq" model = "closed"> <AttributeType name = "isbn" dt:type = "string" required = "yes"/> <attribute type = "isbn"/> <AttributeType name = "inStock" dt:type = "enumeration" dt:values = "yes no" default = "no"/> <attribute type = "inStock"/> <element type = "name"/> <element type = "price"/> <group order = "one"> <element type = "quantity"/> <element type = "available"/> </group> </ElementType> <ElementType name = "name" content = "textOnly" model = "closed" dt:type = "string"/> <ElementType name = "price" content = "textOnly" model = "closed" dt:type = "float"/> <ElementType name = "quantity" content = "textOnly" dt:type = "int" model = "closed"/> <ElementType name = "available" content = "textOnly" dt:type = "date" model = "closed"/> </Schema>
XSL • eXtensible Stylesheet Language • Template for displaying XML data • Client-side (browser dependent) • Server-side (browser independent) • See customer.xsl, customer_xsl.xml, customer_transform.xml
XML and HL7 • Health Level 7 – Application level protocol for communicating medical data • Clinical data • ADT (admission/discharge/transfers) • ORDERS • REPORTS • Administrative data • Billing • Insurance
An HL7 message MSH|^~\&| LABGL1|| DMCRES|| 199812300100|| ORU^ R01| LABGL1199510221838581| P| 2.3 ||| NE| NE PID||| 6910828^ Y^ C8|| Newman^ Alfred^ E|| 19720812| M|| W| 25 Centscheap Ave^^ Whatmeworry^ UT^ 85201^^ P||( 555) 777- 6666|( 444) 677- 7777|| M|| 773789090 OBR|| 110801^ LABGL| 387209373^ DMCRES| 18768- 2^ CELL COUNTS+ DIFFERENTIAL TESTS (COMPOSITE)^ LN||| 199812292128|| 35^ ML||||||| IN2973^ Schadow^ Gunther^^^^ M D^ UPIN ||||||||||^ Once|||||| CA20837^ Spinosa^ John^^^^ MD^ UPIN OBX|| NM| 4544- 3^ HEMATOCRIT (AUTOMATED)^ LN|| 45|| 39- 49 |||| F||| 199812292128|| CA20837 OBX|| NM| 789- 8^ ERYTHROCYTES COUNT (AUTOMATED)^ LN|| 4. 94| 10* 12/ mm3 |4.30- 5.90|||| F||| 199812292128|| CA20837 110801^ LABGL| 387209373^ DMCRES| 18768- 2^ CELL COUNTS+ DIFFERENTIAL TESTS (COMPOSITE)^ LN||| 199812292128|| 35^ ML||||||| IN2973^ Schadow^ Gunther^^^^ M D^ UPIN ||||||||||^ Once|||||| CA20837^ Spinosa^ John^^^^ MD^ UPIN NM| 4544- 3^ HEMATOCRIT (AUTOMATED)^ LN|| 45|| 39- 49 |||| F||| 199812292128|| CA20837 NM| 789- 8^ ERYTHROCYTES COUNT (AUTOMATED)^ LN|| 4. 94| 10* 12/ mm3 |4.30- 5.90|||| F||| 199812292128|| CA20837
The XML <Labrs3P00 T=" Labrs3P00"> <Labrs3P00. PTP T=" PTP"> <PTP. primrPrsnm T=" PN"> <fmn T=" ST"> Sample</ fmn> <gvn T=" ST"> George</ gvn> <mdn T=" ST"> H</ mdn> </ PTP. primrPrsnm> </ Labrs3P00. PTP> <Labrs3P00. SIOO_ L T=" SIOO_ L"> <SIOO_ L. item T=" SIOO"> <SIOO. filrOrdId T=" IID"> LABGL110801</ SIOO. filrOrdId> <SIOO. placrOrdId T=" IID"> DMCRES387209373</ SIOO. placrOrdId> <SIOO. InsncOf T=" MSRV"> <MSRV. unvSvcId T=" CE"> 18768- 2</ MSRV. unvSvcId> <MSRV. svcDesc T=" TX"> CELL COUNTS+ DIFFERENTIAL TESTS (COMPOSITE)</ MSRV. svcDesc> </ SIOO. InsncOf> <SIOO. SRVE_ L T=" SRVE_ L"> <SRVE_ L. item T=" SRVE"> <SRVE. name T=" CE"> 4544- 3</ SRVE. name> <SRVE. svcEvntDesc T=" ST"> HEMATOCRIT (AUTOMATED)</ SRVE. svcEvntDesc> <SRVE. CLOB T=" CLOB"> <CLOB. obsvnValu T=" NM"> 45</ CLOB. obsvnValu> <CLOB. refsRng T=" ST"> 39- 49</ CLOB. refsRng> <CLOB. clnRlvnBgnDtm T=" DTM"> 199812292128</ CLOB. clnRlvnBgnDtm> </ SRVE. CLOB> <SRVE. spcmRcvdDtm T=" DTM"> 199812292315</ SRVE. spcmRcvdDtm> </ SRVE_ L. item> </ SIOO_ L. item> </ Labrs3P00. SIOO_ L> </ Labrs3P00>
HTML, XML HTML, XML HTML HTML Generation 1Static HTML Generation 2Web Applications Generation 3Web Services Web Services OverviewEvolution of the Web
Web Services OverviewApplication Model Partner Web Service Other Web Services Partner Web Service Internet + XML End Users YourCompany.com Application Business Logic Tier Data Access and Storage Tier Other Applications
Web Services Overview Portals Ads Mail Other Svcs Calendar Weather Finance News
Web Services OverviewSample Web Services • E-commerce: order books, office supplies, other products • Track packages: UPS, FedEx • Weather • Maps • Telephone redirection, customizable rules and messages
CreditResponse InventoryResponse CreditCheck Purchase Order ReserveInventory Invoice Example Problem Space Credit Service Consolidate Results PO Service Client Inventory Service
Web Service Demos • WebMethods.net • http://www.webservicelist.com/ • http://www.xmlwebservices.cc/index_Samples.htm#Top • http://www.asitis.co.uk/web-services/
Underlying TechnologiesWeb Services Stack Directory: Publish & Find Services: UDDI Inspection: Find Services on server: DISCO Description: Formal Service Descriptions: WSDL Wire Format: Service Interactions: SOAP Universal Data Format: XML Ubiquitous Communications: Internet Simple, Open, Broad Industry Support
Underlying TechnologiesWeb Services Stack UDDI Directory http://www.uddi.org UDDI or other directory service Locate a Service Link to Discovery Document (XML) Inspection http://www.ibuyspy.com/ibuyspy.disco DISCO Request Discovery Document Return Discovery Document (XML) Web Service Client WSDL Description http://www.ibuyspy.com/ibuyspycs/InstantOrder.asmx?wsdl Request Service Description Web Service Return Service Description (XML) SOAP Wire Format Request Service Return Service Response (XML)
SOAPMessage Structure The complete SOAP message SOAP Message Protocol binding headers Headers <Envelope> encloses payload SOAP Envelope <Header> encloses headers SOAP Header Individual headers Headers <Body> contains SOAP message name SOAP Body Message Name & Data XML-encoded SOAP message name & data
UDDIThe Vision Advanced Discovery via Portals and Marketplaces Marketplace UDDI Registries and Protocol Marketplace Marketplace Search Portal Search Portal Business Users Technical Users
Web Services Overview Technology Fabric Must Span Companies Too
Underlying TechnologiesXML Is the Glue XML HTML TCP/IP Technology Connecting Applications Connectivity Presentation FTP, E-mail, Gopher Innovation Web Pages Connect the Web Web Services Browse the Web Program the Web
Web Services Growth??? ? Web Services: Standards-based integration and interoperability across platforms, applications, and programming languages