b118 web programming l.
Skip this Video
Loading SlideShow in 5 Seconds..
B118 Web Programming PowerPoint Presentation
Download Presentation
B118 Web Programming

Loading in 2 Seconds...

play fullscreen
1 / 37

B118 Web Programming - PowerPoint PPT Presentation

  • Uploaded on

B118 Web Programming Session #13 Forms, XML & Web Services May 3, 2004 Tonight’s Agenda Administrative Order form validation homework bEssentials Final exam Introduction to ASP.NET Web Server Controls XML Web Services Administrative – Order Form Validation Grading criteria

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

B118 Web Programming

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
b118 web programming

B118 Web Programming

Session #13 Forms, XML & Web Services

May 3, 2004

tonight s agenda
Tonight’s Agenda
  • Administrative
    • Order form validation homework
    • bEssentials
    • Final exam
  • Introduction to ASP.NET Web Server Controls
  • XML
  • Web Services
administrative order form validation
Administrative – Order Form Validation
  • Grading criteria
  • Solution discussion
administrative bessentials
Administrative – bEssentials
  • Peer evaluations: based on contribution effort towards the team, showing up for meetings, meeting commitments for deliverables, etc.
  • 5 percentage points out of the 30 percentage points for the project, proportional to the overall group score
  • Allocate points from the pot to your team members:
  • Don’t exceed the # of points you have to allocate! If you do, they come out of your points!
  • Don’t give yourself any points!
  • Due on the day of the final – if you forget, you get ZERO for peer evaluation
administrative bessentials5
Administrative – bEssentials
  • Deliverables on the Final Exam day:
    • Peer evaluation scores
    • All files uploaded to Cypress
    • On a single sheet of paper:
      • Names of your team members
      • URL of your company’s home page
      • URL of any web pages that your team is especially proud of and would like to bring to my attention
      • Anything else about your web site that you’d like to point out for grade evaluation
  • Be prepared to do a 5 minute demo of your web site in front of the class before we begin the final exam
administrative final exam
Administrative – Final Exam
  • Bring Blue Book
  • Review next class session
introduction to asp net web server controls
Introduction to ASP.NET Web Server Controls
  • Basic controls (text box, radio button, check box) are similar to HTML controls
  • Radio Button List & Check Box List ASP.NET controls do the grouping for you
    • Retrieve list contents from a data source or list collection
    • Dropdown List ASP.NET control uses same implementation model
  • AutoPostBack attribute for immediate or deferred form processing
  • Additional information:
    • Chapter 4 of the text
    • http://www.asp.net/Tutorials/quickstart.aspx, ASP.NET Web Forms topic
asp net validation controls
ASP.NET Validation Controls
  • Does form validation in response to a button click event
    • Required field (asp:RequiredFieldValidator)
    • Range checking of input data (asp:RangeValidator)
    • Verify the input data against a format such as email address, Social Security Number or minimum character length (asp:RegularExpressionValidator)
    • Compare two data from two form controls (asp.CompareValidator)
example form demo aspx
Example: form-demo.aspx
  • Web Matrix Technique highlights
    • Page properties: Events (lightening bolt): Load (double-click) to create Page_Load subroutine template
    • Create ListItems for a list control by clicking on (…) icon in collections
  • Programming techniques
    • RadioButtonList1.SelectedIndex=-1 to deselect all items in the list
  • See what happens when you:
    • Set AutoPostBack = "False"
    • Set CausesValidation = "True"
xml introduction
XML - Introduction
  • Core technology for one of the hottest areas in IT today
  • An essential, "must know" topic if you want to stay current in web programming
  • An excellent format for packaging and communicating data between humans, machines or both
    • Firewalls may block binary data, XML is text only so it doesn’t have any problems getting through
xml overview
XML – Overview
  • XML = eXtensible Markup Language
  • But it’s really not a language
  • It’s a standard format for writing your own language in a way that other people (and applications) can easily learn
  • Resembles HTML, similar to XHTML in terms of grammar rules (nesting, end tags, attribute values in quotes, comments, etc.)
    • Tag names are case sensitive!
xml s hidden role in net
XML’s Hidden Role in .NET
  • XML’s most useful place isn’t in a web application you might create, rather it’s in the infrastructure supporting your web application
  • Places where .NET makes use of XML:
    • ADO.NET Data Access
    • Configuration files like web.config
    • Web Services
    • Anywhere that .NET needs to store miscellaneous data such as the list of files to display in the AdRotator control
xml basic
XML Basic
  • Compare these two product catalog data files

Traditional text file format:










Fruit Basket



XML file format:

<?xml version = "1.0"?>
















<name>Fruit Basket</name>





  • XML isn’t a replacement for a real database
    • XML doesn’t have all of the mechanisms that a database package has (to enforce table relations or manage concurrency issues, for example)
  • In addition to the XML document itself, there are two other components:
    • Document Type Definition (DTD) or XML Schema (XSD)
    • eXtensible Style Sheets (XSL) – optional for displaying the XML document
dtd example
DTD Example


<?xml version="1.0"?>

<BOOK InStock="true">

<TITLE>The Marble Faun</TITLE>

<AUTHOR>Nathaniel Hawthorne</AUTHOR>

<BINDING>trade paperback</BINDING>







<!ATTLIST BOOK InStock (true|false) #REQUIRED >






xml schema example
XML Schema Example


<?xml version="1.0"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:element name="BOOK">



<xsd:element name="TITLE" type="xsd:string"/>

<xsd:element name="AUTHOR" type="xsd:string"/>

<xsd:element name="BINDING" type="xsd:string"/>

<xsd:element name="PAGES" type="xsd:positiveInteger"/>

<xsd:element name="PRICE" type="xsd:decimal"/>


<xsd:attribute name="InStock" type="xsd:boolean" use="required"/>




xml facilities in net
XML Facilities in .NET
  • Handle XML as a special type of text file
    • XmlTextWriter, XmlTextReader
    • Text stream I/O (you need to construct tags by specifying element names)
    • Good for storing simple blocks of data
      • You need to keep track of the structure and the order of the element tags (<name> then <price> then <StockQty>, for example)
    • Maintains connection to the actual data
xml facilities in net xmltextwriter
XML Facilities in .NET: XmlTextWriter

Dim fs As New FileStream ("c:\myFile.xml", FileMode.Create)

Dim w As New XmlTextWriter(fs, Nothing)



‘ Write the first product


w.WriteAttributeString("ID", "", "1")

w.WriteAttributeString("Name", "", "Chair")





‘ Close the root element




xml facilities xmltextwriter cont d
XML Facilities: XmlTextWriter (cont’d)
  • Produces this XML file:

<?xml version="1.0">


<Product ID="1" Name="Chair">




xml facilities in net20
XML Facilities in .NET
  • Handle XML as a collection of in-memory objects
    • XmlDocument, XmlNode
    • Makes the entire XML document structure available as an in-memory object
      • You set values to node properties, order of the element tags is maintained for you
      • Tag pairs (<name> </name>) handled for you
    • Offers ability to search for content by element ID or element tag name
    • A copy of the original data
    • Similar in concept to ADO.NET DataSet
xml facilities in net21
XML Facilities in .NET
  • Handle XML as a special interface to relational data
    • XmlDataDocument
    • Lets you read an XML document and then bind it to ADO.NET data controls such as DataGrid
xml facilities in net22
XML Facilities in .NET
  • Process an XML document through XSL (to create an HTML document, for example)
    • XmlTransform to generate the output stream
    • Xml takes XmlTransform output to generate an HTML page
xml demo programs
XML Demo Programs
  • All of these programs use the rental.mdb from B188
web services introduction
Web Services - Introduction
  • Why? The architecture for Internet applications is very similar to the client/server architecture of about five years ago: monolithic, a full-featured application containing a variety of services behind a single proprietary user interface
the era of monolithic applications
The Era of Monolithic Applications
  • Single web application offering a comprehensive set of services such as a financial services site (with access to individual savings, credit card, insurance information and services)
limitations of monolithic applications
Limitations of Monolithic Applications
  • Take a lot of time and resources to create
  • Often tied to specific platforms or technologies, can’t be easily extended or enhanced
  • Difficult to get multiple applications to work together beyond just a hyperlink
  • Units of application logic can’t easily be reused between applications (this is the next level above just sharing source code or object classes)
  • You have to go through the complete, monolithic application even if all you want is a simple piece of information (such as your savings balance or the current loan rate for a specific program)
components and the com revolution
Components and the COM Revolution
  • On the standalone desktop application level, Microsoft addressed these problems through their COM (component object model) technology which produced ActiveX controls
    • A lot of the individual functional services inside of Word and Excel are available as ActiveX controls, for example
  • Web Services offers the same re-usable and more easily accessible functionality over a networked environment
web services and the programmable web
Web Services and the Programmable Web
  • Web Services are individual units of programming logic that exist on a web server
  • Built on open standards, not a platform-specific binary standard
  • Think of it as being able to call classes/subroutines/functions over a network
  • XML-based
  • Contains only the information for communication between a Web Service and client, nothing on the inner workings of the service
    • Designed for reading by applications
  • To see the WSDL for an ASP.NET Web Service, add ?WSDL to the query string:


  • One of the three supported standards for the transmission of Web Service information (the other two being HTTP GET & HTTP PUT)
  • HTTP GET/PUT sends information as simple name/value pairs, SOAP uses a well-formatted XML document
  • Web Services are available at a specific URL address. How do you let the world know about this address? What if you need to change the address?
  • DISCO is a machine-readable "HTML page with links to Web Services"
  • As long as your application knows how to find the site’s .disco file, it can then find all of the Web Services available at that site
  • Proposed by Microsoft, very new and not yet widely adopted
  • Conceptually equivalent to a Yahoo! for web services
  • Sits at the level above DISCO files. It’s a means for businesses to advertise all the Web Services they have
  • The UDDI registry itself is a Web Service
  • Details at http://uddi.microsoft.com
communicating with a web service

Standalone Web Application

Web Service Client

Service Class


Web Application

Web Application



Web Service

Web Service Class

Communicating with a Web Service


creating a web service
Creating a Web Service
  • Code a .asmx file

<WebService (Description:="Bus118W Web Service demo", _

Namespace:="http://cob.sjsu.edu")> _

Public Class GetTransactions

Inherits WebService

  • Put it through the WSDL compiler to generate a Visual Basic source file:

wsdl.exe /language:vb http://localhost/rental-XMLWebSvc.asmx?WSDL

  • Compile VB source file to generate proxy DLL

vbc.exe /t:library /out:GetTransactions.dll /r:system.dll /r:system.web.dll /r:system.web.services.dll /r:system.xml.dll /r:system.data.dll GetTransactions.vb

xml web services demo programs
XML & Web Services Demo Programs
  • All of these programs use the rental.mdb from B188
  • Commercial web services
    • WeatherByZipClient.aspx
      • Calls a web service that returns current weather conditions for a given ZIP code
    • GoogleAPIClient.aspx
      • Calls a web service operated by Google