Introduction to XML and Web Service ISYS 512/812.

Slides:



Advertisements
Similar presentations
XML-XSL Introduction SHIJU RAJAN SHIJU RAJAN Outline Brief Overview Brief Overview What is XML? What is XML? Well Formed XML Well Formed XML Tag Name.
Advertisements

Intesar G Ali IT DepartmentPalestinian Land Authority Web services Prepared by: Intesar Ali IT Department PLA August 2010.
Web Service Ahmed Gamal Ahmed Nile University Bioinformatics Group
An Introduction to XML Based on the W3C XML Recommendations.
3 November 2008CIS 340 # 1 Topics To define XML as a technology To place XML in the context of system architectures.
CS 898N – Advanced World Wide Web Technologies Lecture 21: XML Chin-Chih Chang
Concurrency Control. R/RR/W W/W User 2 ReadWrite User 1 Read Write R/W: Inconsistent Read problem. W/W: Lost Update problem.
Authenticating Users in an ASP.NET Application. Web Site Administration Tool From VS 2008, click Website/ ASP.Net Configuration to open Web Site Administration.
VB.NET Database Tools ISYS Net Applications OLE DB Provider OLE DB Data Source OLE DB Provider ODBC Data Source SQL Server Data Source SQL Server.Net.
Website Security ISYS 512. Authentication Authentication is the process that determines the identity of a user. Web.config file – node Options: –Windows.
ASP.Net AJAX. AJAX Asynchronous JavaScript and XML: – JavaScript, Document Object Model, Cascade Style Sheet, XML, server-side script such as.Net, etc.
Web Site Security ISYS 512/812. Authentication Authentication is the process that determines the identity of a user. Web.config file – node Options: –Windows:
Web Page Introduction. What is a web page? A hypertext that contains clickable links. A web page is a text file containing Hyper Text MarkUp Language.
VB.NET Database Tools ISYS 573. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
Introduction to Web Application Development with.Net and Web Service ISYS 350.
Coding ADO.NET Objects: Connection, Command, DataReader.
Introduction to XML ISYS 573. HTML vs XML HTML is a language specifically designed for displaying information in browser. It doesn’t carry information.
Working with Session. Postback and Variables Variables declared in a web page including ADO.Net objects may be reinitialized and lose their values.
DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 5 – XML Basic School of Architecture, Design Science and Planning Faculty of.
XML(EXtensible Markup Language). XML XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe.
Tutorial 11 Creating XML Document
Introduction to XML: Yong Choi CSU Bakersfield.
Upgrading to XHTML DECO 3001 Tutorial 1 – Part 1 Presented by Ji Soo Yoon 19 February 2004 Slides adopted from
Introduction to Web Service ISYS 512. Web Service XML Web Service Web services are classes that are stored on the web which can instantiate and use in.
ASP and HTML. Anchor Tag testAnchorTag Demo: ASPNet/ASPNETProdListSelf.ASPX.
Web Page Introduction. What is a web page? A web page is a text file containing markup language tags. –A markup language combines text and extra information.
Introduction to XML This material is based heavily on the tutorial by the same name at
Introducing HTML & XHTML:. Goals  Understand hyperlinking  Understand how tags are formed and used.  Understand HTML as a markup language  Understand.
Web Page Introduction. What is a web page? A web page is a text file containing markup language tags. –A markup language combines text and extra information.
ECA 228 Internet/Intranet Design I Intro to XML. ECA 228 Internet/Intranet Design I HTML markup language very loose standards browsers adjust for non-standard.
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition.
WORKING WITH NAMESPACES
XP New Perspectives on XML Tutorial 4 1 XML Schema Tutorial – Carey ISBN Working with Namespaces and Schemas.
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.
Web Page Introduction. What is a web page? A web page is a text file containing markup language tags. –A markup language combines text and extra information.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
XML: Overview MIS 181.9: Service Oriented Architecture 2 nd Semester,
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
XML 1 Enterprise Applications CE00465-M XML. 2 Enterprise Applications CE00465-M XML Overview Extensible Mark-up Language (XML) is a meta-language that.
Web Page Introduction. What is a web page? A web page is a text file containing markup language tags. –A markup language combines text and extra information.
Web Services (SOAP, WSDL, UDDI) SNU OOPSLA Lab. October 2005.
 XML is designed to describe data and to focus on what data is. HTML is designed to display data and to focus on how data looks.  XML is created to structure,
Tutorial 1: XML Creating an XML Document. 2 Introducing XML XML stands for Extensible Markup Language. A markup language specifies the structure and content.
Introduction to XML and Web Service ISYS 464. HTML vs XML HTML is a language specifically designed for displaying information in browser. It doesn’t carry.
XML Extensible Markup Language
XP Tutorial 9 1 Working with XHTML. XP SGML 2 Standard Generalized Markup Language (SGML) A standard for specifying markup languages. Large, complex standard.
XML – An Introduction Structured Data Mark-up James McCartney CSCE 590, Cluster and Grid Computing.
XML 2nd EDITION Tutorial 1 Creating An Xml Document.
Waqas Anwar Next SlidePrevious Slide. Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language.
HTML Basics BCIS 3680 Enterprise Programming. Web Client/Server Architecture 2  Your browser (the client) requests a Web page from a remote computer.
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
XP 1 Creating an XML Document Developing an XML Document for the Jazz Warehouse XML Tutorial.
XP New Perspectives on XML, 2nd Edition Tutorial 2 1 TUTORIAL 2 WORKING WITH NAMESPACES.
Introduction to Web Service ISYS 512. Web Service XML Web Service Web services are classes that are stored on the web which can instantiate and use in.
Accessing Data Using XML CHAPTER NINE Matakuliah: T0063 – Pemrograman Visual Tahun: 2009.
ASP.Net and HTML. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load dim strConn as string ="Provider=Microsoft.Jet.OLEDB.4.0;Data.
XML Design Goals 1.XML must be easily usable over the Internet 2.XML must support a wide variety of applications 3.XML must be compatible with SGML 4.It.
XML Introduction. Markup Language A markup language must specify What markup is allowed What markup is required How markup is to be distinguished from.
Tutorial 13 Validating Documents with Schemas
1 Tutorial 12 Working with Namespaces Combining XML Vocabularies in a Compound Document.
XML Engr. Faisal ur Rehman CE-105T Spring Definition XML-EXTENSIBLE MARKUP LANGUAGE: provides a format for describing data. Facilitates the Precise.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
Web Page Introduction. What is a web page? A hypertext that contains clickable links. A web page is a text file containing Hyper Text MarkUp Language.
Introduction to XML Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
CHAPTER NINE Accessing Data Using XML. McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Introduction The eXtensible.
Web Page Introduction.
XML QUESTIONS AND ANSWERS
Web Services Introduction
Coding ADO.NET Objects: Connection, Command, DataReader
Presentation transcript:

Introduction to XML and Web Service ISYS 512/812

HTML vs XML HTML is a language specifically designed for displaying information in browser. It doesn’t carry information about the structure of the content held within its page. XML (Extensible MarkUp Language) is a language used to represent data in a form that does not rely on any particular proprietary technology. It uses user-defined tags to give meaningful names to data elements. With XML, we separate the data content from the data presentation.

HTML My Favorite Book ISBN Authors: John Smith Peter Chen Price: $45.00 Description: This is a grerat book

XML John Smith Peter Chen David Chao $45.00 This is a grerat book Adam Smith $25.00 This is a second great book

XML Document Well-formed documents: –Documents comply with the rules of XML syntax. Valid documents: –Documents that are well-formed and comply with a XML schema or Document Type Definition (DTD is a file containing the rules used to define the document).

Well-Formed Documents There is only one root node. All elements must have a start tag and an end tag (except for an empty element, see example below) Elements must be nested correctly. If an element has an attribute, the attribute value must be quoted. –An empty element with an attribute: Note: XML is case sensitive.

XML Documents The XML declaration: – –Note: xml should be in lower case. Namespaces –Define a namespace:xmlns:”uri” where the Uniform Resource Identifier is a unique identifier and is often a URL. –Use a namespace to make a tag unique: Elements: –Each start-tag/end-tag pair, with the data that lies between them, is an element. –Ex. John Smith –The start and end tag must be in the same case.

Attributes: Elements can have attributes. These are values that are passed to the application, but not constitute part of the content of the element. Attributes are included as part of the element’s start tag, and values must be enclosed in quote marks. – Spinach – Carrot

Comments: – Processing instructions: These allow documents to contain instructions for applications using XML data. –

Tree View of XML Books Book ISBN Authors Price Description Book ISBN Authors Price Description Author

Valid Documents Well-formed documents that conform to an XML schema. XML parsers are programs that are able to validate an XML document against schema.

XML Schema Definition of an XML Document Namespaces: Allow element names to be qualified to avoid name collisions. Complex and simple types: –Elements that contains other elements are complex type. Cardinality: –minOccurs: 0 for optional element. –maxOccurs: specified number or unbounded Compositor: –Sequence: defines an ordered sequence of subelements. –Choice: defines a choice between several possible elements. Constraints: –Uniqueness contraint

VS.Net Tools for XML Document and Schema XML Schema: –Project/Add New Item/XML Schema Drag tables from Server Explorer One table Two tables with relation View Code XML File: –Project/Add New Item/XML File Add tags

Creating XML File Chao Smith Chen

Read XML File DataSet object’s ReadXML method. –Add a new dataset object: Project/Add New Item/DataSet Use the ReadXML method to read XML file into the dataset. Dim MyDs As New DataSet2 MyDs.ReadXml("C:\ VBExamplesVS05\TestXML\TestXML\XMLFile1.xml", XmlReadMode.InferSchema) Dim objDataView As New DataView(MyDs.Tables("Book")) DataGridView1.DataSource = objDataView

Write XML Schema Dim MyDs As New DataSet2 MyDs.ReadXml("C:\VBExamplesVS05\TestXML\TestXML\ XMLFile1.xml", XmlReadMode.InferSchema) MyDs.WriteXmlSchema("c:\MyDsSchema.txt") MyDs.WriteXml("c:\MyDsXML.txt")

Style Sheets XSL: Extensible Stylesheet Language Tell the browser how to display the XML document. With a style sheet, all of the style rules are kept in one file and the source document simply links to this file. File extension:.CSS

Browser screen structure: –Page Area –Block Flow Object: Taking up the whole line. –In-Line Flow Object: Several in-line objects may be on the same line.

My Favorite Book John Smith Peter Chen $45.00 This is a grerat book My Second Favorite Book Adam Smith $25.00 This is a second great book

btitle{ display:block; font-family: Aerial, Helvetica; font-weight: bold; font-size: 20pt; color: #9370db; text-align: center; } ISBN{ display:block; font-family: Aerial, Helvetica; font-weight: bold; font-size: 12pt; color: #c71585; text-align: left; } Authors{ display:inline; font-family: Aerial, Helvetica; font-style: italic; font-size: 10pt; color: #9370db; text-align: left; }

Price{ display:block; font-family: Aerial, Helvetica; font-size: 12pt; color: #ff1010; text-align: left; } Description { display:block; font-family: Aerial, Helvetica; font-size: 12pt; color: #ff1010; text-align: left; }

Demo ASPNet/FavoriteBook.htm

Web Service XML Web Service Web services are classes that are stored on the web which can instantiate and use in both Windows and Web applications.

To Add a New Web Service: Website/Add New Item/Web Service –Web Service has an extension: ASMX –The CodeBehind File is stored in the App_Code folder. Web Services are defined as Web Method: – _

A Web Service Example Public Class MyWebService Inherits System.Web.Services.WebService Public Function GetCname(ByVal CID As String) As String Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = c:\salesDB.mdb" Dim objConn As New OleDbConnection(strConn) Dim strSQL As String = "select * from customer where CID = '" & CID & "';" Dim objComm As New OleDbCommand(strSQL, objConn) objConn.Open() Dim objDataReader As OleDbDataReader objDataReader = objComm.ExecuteReader() If objDataReader.Read() Then Return objDataReader("Cname") Else Return ("Not exist") End If End Function End Class

Web Service Description Language (WSDL) A WSDL file is an XML document containing a complete description of the web service. It shows a web service’s name, methods, and parameter types. Help page: After entering web service’s URL, a help page is displayed. You can click the Service Description link to see the WSDL file.

Returning a Complex Data Type Examples: –ArrayList –DataSet –User-defined object Customer Class

Returning an ArrayList Public Function GetCnameRating(ByVal CID As String) As ArrayList Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = c:\salesDB.mdb" Dim objConn As New OleDbConnection(strConn) Dim strSQL As String = "select * from customer where CID = '" & CID & "';" Dim objComm As New OleDbCommand(strSQL, objConn) objConn.Open() Dim objDataReader As OleDbDataReader objDataReader = objComm.ExecuteReader() Dim temp As New ArrayList If objDataReader.Read() Then temp.Add(objDataReader("Cname")) temp.Add(objDataReader("Rating")) Else temp.Add("Not exist") End If Return temp End Function

Returning a DataSet Public Function GetCustomerDataSet() As DataSet Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = c:\salesDB.mdb" Dim objConn As New OleDbConnection(strConn) Dim strSQLSelect As String = "select * from customer;" Dim objDataSet As New DataSet() Dim objAdapter As New OleDbDataAdapter(strSQLSelect, objConn) objAdapter.Fill(objDataSet, "Customer") Return objDataSet End Function

Consuming Web Services from a Windows Application Add a web reference to the web service: –Project/Add Web Reference Local computer Imports the web service Declare a web service class variable. –Dim UseWs As New DBWebService Note: Web Service CodeBehind file location.

Code Example (Windows Project) Imports TestXML.MyWService Public Class Form3 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim MyWs As New MyWebService Try MessageBox.Show(MyWs.GetCname(InputBox("enter cid: "))) Catch except As SystemException MessageBox.Show(except.Message) End Try End Sub End Class

Using a DataSet Returning by Web Service (Web Project) Imports DBWS Imports System.Data Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim UseWs As New DBWebService Dim MyDs As New dataset MyDs = UseWs.GetCustomerDataSet() GridView1.DataSource = MyDs.Tables("customer") GridView1.DataBind() End Sub End Class

Reference a Web Service on Internet Mortgage calculator

Universal Description, Discovery, and Integration (UDDI) A directory service for web services. – UDDI is an open industry initiative enabling businesses to publish service listings and discover each other and define how the services or software applications interact over the Internet. A UDDI business registration consists of three components: –White Pages — address, contact, and known identifiers; –Yellow Pages — industrial categorizations based on standard taxonomies; and –Green Pages — technical information about services exposed by the business.

Loosely Coupled Software Refers to software routines (modules, programs) that can be called by an application and executed as needed. For example, Web services are loosely coupled software modules that are invoked on demand when required. An approach to designing interfaces across modules to reduce the interdependencies across modules or components – in particular, reducing the risk that changes within one module will create unanticipated changes within other modules.

Benefits of Loosely Coupled Software This approach specifically seeks to increase flexibility in adding modules, replacing modules and changing operations within individual modules. It assumes a modular approach to design. It values flexibility. It seeks to increase flexibility by focusing on design of interfaces.

Service Oriented Architecture SOA expresses a perspective of software architecture that defines the use of loosely coupled software services to support the requirements of the business processes and software users. In an SOA environment, resources on a network are made available as independent services that can be accessed without knowledge of their underlying platform implementation. A service-oriented architecture is not tied to a specific technology. It may be implemented using a wide range of technologies.