XML and Web Services BA 370 XML and Web Services Leo Putra Mardjuki Christopher William Lee Corey Fung Chan BA 370 Dr Ren F Reitsma December 2 2005 0 XML and Web Services BA 370 Abstract Despite of its recent creation XML is one of the biggest breakthroughs in the last decade Its main purpose is to describe data However it is also being used by several industry for structuring storing and sending information It has been amazing to see how quickly the XML standard has been developed and how quickly a large number of software vendors have adopted the standard Furthermore we strongly believe that XML will be as important to the future of the Web as HTML has been to the foundation of the Web Nevertheless upon learning on its benefits towards businesses and personal usage XML technology is likely to become a standard for all data transmission and data manipulation over the Web Web services on of the most important XML based technologies provide simplicity throughout the web because they provide a standard for exchanging information There are three main elements used in Web services UDDI SOAP WSDL 1 XML and Web Services BA 370 XML Basics Origin of XML XML emerged as a way to overcome the shortcomings of its two predecessors SGML and HTML which were both very successful markup languages but were both flawed in certain ways SGML is complex not made for the web and also expensive Furthermore it is not being supported by commercial browsers HTML is free simple and also widely supported However it has no provisions for extending itself in a standard way into new tags or data structures and is too limited Therefore in 1996 the World Wide Web Consortium W3C decided to sponsor a group of people from Sun to define a markup language with the power and extensibility of SGML but with the simplicity of HTML Jon Bosak led the creation of XML specification of the W3C He organized the W3C XML activity in 1996 and has chaired the W3C XML Working Group since its inception In 1998 the W3C approved Version 1 0 of the XML specification and a new language was born Uses of XML XML has many different uses which could benefit us in several ways It can keep data separated from your HTML used to store data inside HTML documents used as a format to exchange information and also used to store data in files or in databases What is XML XML stands for eXtensible Markup Language It is designed to meet the challenges of large scale electronic publishing and data exchange It plays important roles in the exchange of a wide variety of data across the web especially for documents that are rich in data such as sales and inventory data XML is a metalanguage written in SGML It allows an individual to define his her own language and applications and establishes rules about formatting and marking up a document 2 XML and Web Services BA 370 Simple structure of XML Figure 1 below shows a simple XML example of storing OSU Student data Figure 1 XML example Line 1 Line 2 Line 3 Line 4 Line 5 Line 6 Line 7 Line 8 Line 9 Line 10 xml version 1 0 OSU OSU Student Student ID 123456789 Student ID Major Business Major FirstName Don FirstName MiddleName Won MiddleName LastName Demarko LastName OSU Student OSU The first line of code defines the XML version and the character encoding used in the document In this case the document conforms to the 1 0 specification of XML The next line shows how XML stores the information XML stores information by using elements which are containers that contain data and structure data according to the author s likings Elements are the tags in XML such as OSU Students or Student ID In XML there must be a hierarchical structure of elements Line 2 describes the root element line 3 the sub element Line 4 through Line 8 are sub child elements and finally the last lines defines the end of root element This hierarchical structure of elements is used to describe data Think of it as the root element as the main topic and the sub elements within sub elements are the detailed information about the main topic Since the naming and structuring of elements are not predefined there must be a conceptual framework that describes the underlying structure of an individual s collection of elements There are two types of ways of doing this through DTDs or Schemas What is Schema A schema is a conceptual framework that describes the underlying structure of an individual s collection of elements It defines the vocabularies of an element types and attributes for a given class of documents and allows individual to share those documents with other applications In addition a schema also plays a role in information retrieval Schemas can be formally defined as DTDs 3 XML and Web Services BA 370 What is DTD DTD stands for Document Type Declaration Its main functions are to define the legal building blocks of an XML document and also to define the document structure with a list of legal elements There are two types of DTDs internal DTDs Figure 3 and external DTDs Figure 2 External DTD If the DTD is external to your XML source file it is an external DTD The benefits of using external DTDs is that they can more easily and efficiently be shared by more than one XML document you can write a DTD once and have multiple documents reference it External DTDs saves time by reducing the typing needed if you made all your DTDs internal If changes are made to the central DTD all documents that rely on the DTD are updated in one fell swoop Thus if you re using a DTD for multiple documents it makes more sense to have the DTD in a separate external file DTD changes will not necessarily be backwards compatible so watch out Figure 2 Example of External DTD XML fragment Line 1a xml version 1 0 Line 2a DOCTYPE note SYSTEM note dtd Line 3a note Line 4a to Tove to Line 5a from Jani from Line 6a heading Reminder heading Line 7a body See you later body Line 8a note Note dtd Line 1b ELEMENT note to from heading body Line 2b ELEMENT to PCDATA Line 3b ELEMENT from PCDATA Line 4b ELEMENT heading PCDATA Line 5b ELEMENT body PCDATA Figure 2 is an XML source file The important thing to notice is Line 2a which is where the XML file gives the location of the external DTD file note dtd The right hand side of the table shows the external DTD Line 1b defines the note element as having four elements to from heading and body and Line 2b through Line 5b define each of these the elements to be of type PCDATA 4 XML and Web Services BA 370 Internal DTD If the DTD is included in your
View Full Document