Web Services November 2001 Interoperability One requirement for an effective distributed environmental data system is interoperability, defined as, “the ability to freely exchange all kinds of spatial information about the Earth and about objects and phenomena on, above, and below the Earth’s surface; and to cooperatively, over networks, run software capable of manipulating such information.” (Buehler & McKee, 1996) Such a system has two key elements: • Exchange of meaningful information • Cooperative and distributed data management Web Services as Program Components • A Web Service is a URL addressable resource that returns requested data. The ‘service provider’ resides on the Internet. • Web Services allow computer to computer communication, regardless of their language or platform. • Web Services are reusable components, as ‘LEGO blocks’, that can be integrated to create larger, richer applications. • Example web services are: current weather server, currency converter, map server. • Web Services use standard web protocols: SOAP, XML, HTTP. • (Need a picture here: service provider-clients architecture) • WS transform the web from a medium for viewing and downloading to a distributed computing and data/knowledge-exchange platform. Web Services • Current distributed application methodologies, DCOM, CORBA, RMI, are for homogeneous environments, not for suitable integration across the heterogeneous Internet. • Web Services provide simple, flexible standard-based model for integrating applications from reusable, interoperable components distributed over the the Internet. • This allows agile application development by making it simple to integrate resources within and outside the organization. 3-Tier Architecture: Presentation, Business Logic and Data Access Web Services: Connect, Communicate, Describe, Discover Enabling Protocols of the Web Services architecture: • Connect: Extensible Markup Language (XML) is the universal data format that makes connection and data sharing possible. • Communicate. Simple Object Access Protocol (SOAP) is the new W3C protocol for data communication, e.g. making requests. • Describe. Web Service Description Language (WSDL) describes the functions, parameters and the returned results from a service • Discover. Universal Description, Discovery and Integration (UDDI) is a broad W3C effort for locating and understanding web services. Web Services Enabled by Standards Web Services operate ‘on top’ of many layers of Internet standards, TCP/IP, HTTP… Web services also the use an array of its own standards - some still in development. The data sharing standards for are to facilitate discovery, description and invocation Discovery Description Invocation UDDI WSDL, XSchema SOAP Disco XSD, XSI XML On top of these Internet and Web Service Standards, we will need to develop our own: Naming conventions Metadata standards Uniform database schemata, etc Protocols for Web Services • The industry standard protocols for Web Services are defined by the W3C Consortium. – Data are described by the Simple Object Access Protocol (SOAP) – Data are expressed using Extensible Mark-up Language (XML) – Transmitted using Hyper Text Transport Protocol (HTTP). • SOAP is an XML-based protocol for distributed data exchange consisting of : – Envelope describing what is in a message and how to process it – A set of encoding rules for expressing data types – A convention for representing remote procedure calls and responses – A binding convention for exchanging messages • • • Middle-tier-to-middle-tier method invocation Technology: Serialization of calls into XML packages HTTP Get/Post or SOAP The XML transport for Web Services is plain text, so it can make it across firewalls .NET: Windows Forms for User Interface • Windows Forms framework for User Interface building , has VB6’s ease of development: drag and drop of controls to a form layout. • Event handlers are the .NET way: mapped to a .NET delegate. • The code binding controls to methods is more exposed, as in MFC. • Has new development service Visual Inheritance. .NET: ASP.NET: Dynamic Web pages • Easy WebApp development – drag-drop of controls on a WebForm – Binding control properties to class members and event handlers • • • • • • • Controls execute on serve but render themselves in HTML User input at browser is posted to the server as class data and as properties No need to know HTML – rendering is done by the controls Clear separation of UI (form layout) and ‘business logic’ behind the form ASP.Net is compiled for high performance Automatic Validation Controls on the client makes input more robust Automatic data biding of data source to controls – i.e Data Grid .NET: ADO.NET: Remote Database Access Microsoft ADO.NET PPT • ADO.Net is a set of classes (DataSet and DataAdapter) to access remote data sources; it decouples data source from data consumer through indirection • DataSet is a data container object of structured information on a set of tables; it can can locally cash portions of the database and synchronize changes • Each DataSet object is associated with a subclass of DataAdapter tailored to interact with a particular data source, e.g. SQLAdopter • To change the data source, the consumer need only to change the DataAdapter • User can access tables as properties of DataSet – no need to know SQL • While in transit, XML data can pass through firewalls over regular HTTP port. .NET: DataSet and DataAdapter, another • The DataSet is a container object for one or more DataTables, DataRelations and Constraints. To draw a comparison to classic ASP/ADO, the DataTable is analogous to a RecordSet, and the DataSet is a container for one or more DataTables. DataSet knows nothing about particular data access interfaces like OLEDB or ODBC • The DataAdapter is the bridge between a DataSet and the data source, such as a Microsoft SQL Server database. The DataAdapter manages creating and opening a Connection, executing a Command, returning a DataReader, populating a DataTable and closing the DataReader and Connection. This can be done multiple times to populate multiple DataTables in the same DataSet. • Using a DataSet and DataAdapter is more memory intensive than using a DataReader, since all of the records returned are populated into a DataTable (taking up valuable system resources). The DataReader streams data, using up the memory required for only one record at a time. With that said, there are instances when you would want to use a DataSet and DataAdapter, such as when you need to manipulate the data, iterate through it, or alter it and update it. DataSet: a Small Relational Database The DataTable fulfills the role of a database table The DataColumn determines the data type and name of the column The DataConstraint adds extended information such as primary key,… A collection of DataRow objects holds the data in the DataTable The DataRow also plays the part of an updateable cache ( a cursor???) DataRelation objects link related DataTable objects in the DataSet, providing referential integrity features similar to a database. The DataTable objects can be nested to whatever depth is necessary to replicate the structure of a hierarchical XML document or a relational database. A DataTable can access its relevant linkages using its child and parent Data Relation collections. DataRows make the navigation in a hierarchy even simpler using the GetChildRows() command with the DataRelation name as a parameter. DataAdapter: Accessing the Data • Each .NET data provider has a DataAdapter object: OleDbDataAdapter, SqlDataAdapter (can we make DataAdapters to legacy data servers?) • The SelectCommand property of the DataAdapter retrieves data from the data source. • The InsertCommand, UpdateCommand, and DeleteCommand properties manage updates to the data in the data source. • The Fill method populates a DataTable object in a DataSet with the results of the SelectCommand Distributed Data Browser Architecture XDim Data SQL Table XML Web Services Data Views Session Manager (Broker) OLAP Cube Layered Map GIS Data Satellite OpenGIS Services Vector Connection Cursor-Query Manager Manager Data Access Data View Manager Manager Cursor Time Chart Text, Table Scatter Chart Text Data Web Page HTTP Services Text Data Distributed data of multiple types (spatial, temporal text) The Broker handles the views, connections, data access, cursor Data are rendered by linked Data Views (map, time, text) .NET Data Providers - A Basic Tutorial DataSet Common client data store • Relational View of Data – • • Tables, Columns, Rows, Constraints, Relations Directly create metadata and insert data Explicit Disconnected Model – – Disconnected, remotable object No knowledge of data source or properties • • – – Common Behavior Predictable performance characteristics Array-like indexing Strong Typing DataSet Tables Table Columns Column Constraints Constraint Rows Row Relations Relation DataAdapter • Loads a table from a data store and writes changes back. – Exposes two methods: • Fill(DataSet,DataTable) • Update(DataSet,DataTable) – Provides mappings between tables & columns – User provides insert/update/delete commands • Allows use of Stored Procedures • Autogen component available – Allows single DataSet to be populated from multiple different datasources DataSet Fill() Update() SelectCommand InsertCommand UpdateCommand DeleteCommand Mappings Mappings Mappings DataAdapter Data store