architecture of present and future web technologies jay sissom indiana university...
TRANSCRIPT
Architecture of Present and Future Web Technologies
Jay SissomIndiana [email protected]
Version 2.0
So Many Tools, So Little Time
Agenda
Basics Example application Tool overview DHTML/XML Summary
•Perl/CGI•Perl Apache Module•PHP 3•Cold Fusion•Active Server Pages•VB Webclasses•Java Server Pages•Java Servlets•Enhydra Java App Server
•Perl/CGI•Perl Apache Module•PHP 3•Cold Fusion•Active Server Pages•VB Webclasses•Java Server Pages•Java Servlets•Enhydra Java App Server
Disclaimers and Fine Print
Jay likes compiled languages much better than interpreted
Jay likes strongly typed languages Jay has LOTS of opinions What’s right for Jay might not be right
for you Examples don’t contain all the error
checking they should!
Web Transaction
Client Server
http://webdev.indiana.edu/cgi-bin/AcctBal webdev.indiana.edu
Web Transaction
Server
Connect to webdev.indiana.edu
Hello client, how may I serve you?
GET /cgi-bin/AcctBal
I’m going to run this program
/www/cgi-bin/AcctBal, then send you it’s output
Thanks, Bye!
Bye!
Client
http://webdev.indiana.edu/cgi-bin/AcctBal webdev.indiana.edu
Example program
IU departmental surplus auction site Modeled after eBayTM
Perl/CGI
CGI – Common Gateway Interface – the original dynamic web content interface
Perl – Interpreted language that excels at text processing
Perl
One of the most used web programming languages
Interpreted language Weakly typed Basic object oriented features Available on almost any Unix and Windows 9x,
NT, 2000 Open Source
Perl Pros
Free! Fairly quick development Tons of add-in modules Lots of documentation Has some object oriented features Has a database abstraction layer (DBI)
Perl/CGI Cons
JAY WARNING: Interpreted, Weakly typed CGI has lots of overhead
Perl/CGI Resources
http://www.perl.com/ - A bunch of Perl resources
http://www.cpan.org/ - Perl Modules http://www.perl.org/ - More Perl stuff
Perl Apache Web Module
An add-on to the Apache web server Lets you write web server modules in Perl Perl modules are loaded/compiled when the
web server loads Modules are reloaded when code changes (in
some cases) Open Source
Perl Web Module Pros
Free! Fairly easy to learn Code loaded and compiled once Tons of add-in modules/databases Lots of documentations Has a database abstraction layer (DBI)
Perl Web Module Cons
JAY WARNING: Interpreted, Weakly typed You are tied to Apache Difficult to develop/debug
Perl Web Module Resources
http://perl.apache.org/ - Get software/docs http://perl.apache.org/guide/ - Usage guide http://perl.apache.org/faq/ - FAQ http://perl.apache.org/dist/cgi_to_mod_perl.html
– Changing program from CGI – Mod Perl
PHP
Hypertext Preprocessor Embeds code within HTML pages Supports many OS’s/Web Servers Open Source
PHP Pros
Free! Easy to learn Easy development Some basic object oriented features Supports many modules/databases
PHP Cons
Interpreted/Weakly typed language No database abstraction layer
PHP Templates
<?php // code include “whatever.template”; ?>
<?php // code include “whatever.template”; ?>
<HEAD><TITLE><?php echo $title; ?>…
<HEAD><TITLE><?php echo $title; ?>…
whatever.template
PHP Resources
http://www.php.net/ - PHP offical source http://www.phpbuilder.com/ - Example code
Cold Fusion
Interpreted HTML preprocessor Code is embedded in HTML pages Specialized tags contain code Works on NT/Solaris/Linux Commercial Product
Cold Fusion Pros
Commercial Support is available A popular web development tool Has OLEDB and native database drivers in
addition to ODBC
Cold Fusion Cons
Interpreted language Weakly typed language No OO features
Cold Fusion Resources
http://www.allaire.com/ - Allaire Corp http://www.houseoffusion.com/ - Cold Fusion
articles/information http://www.cfscripts.com/ - Scripts http://www.defusion.com/ - More stuff http://www.cfmcentral.com/ - More stuff
Active Server Pages
HTML preprocessor Interpreted language Code embedded within HTML pages NT/W2K only (3rd party package for Unix) Only OO features come from COM
Active Server Pages Pros
Free (comes with NT Option Pack or W2K) Quick development Extremely popular Pretty good development tools
Active Server Pages Cons
Pretty much limited to IIS on NT or W2K COM objects must be developed in different
language Very Weakly typed and Interpreted Only supports ODBC & OLEDB database
interfaces
Active Server Pages Resources
http://www.asptoday.com/ - Articles about ASP http://msdn.microsoft.com/ - MS docs http://www.develop.com/ - #1 MS technology
training company
VB Webclasses
Web application development tool in Visual Basic
Comes in the Professional & Enterprise versions of VB
Compiled code that use HTML templates Only runs on IIS under NT or W2K
VB Webclasses Pros
HTML and logic are separate (kinda) Logic is compiled! Language is strongly typed (if you like) Programmers write code, graphics designers
write HTML
VB Webclasses Cons
Microsoft might drop the feature in a future version
There are still bugs in the VB feature Not enough separation between HTML and
logic
Webclasses & Visual Studio SP3+ don’t work well with
Windows 2000!*
Webclasses & Visual Studio SP3+ don’t work well with
Windows 2000!*
Webclasses & Win 2000
Knowledgebase Q255502 Knowledgebase Q259725 Knowledgebase Q234317
VB Webclasses Resources
http://msdn.microsoft.com/ http://www.asplists.com/asplists/faqvbwebclass
es.asp - FAQ
http://www.desertware.com/vbuniverse/webclass.htm - Resources
Java Server Pages
Free! (Sometimes) The Java version of ASP & PHP Java code embedded within HTML Code is compiled and saved on first use Available on many OS/Web Servers Java is very object oriented
Java Server Pages Pros
Code is portable Very Strongly typed language Code is compiled once It’s not very difficult to port ASP to JSP
Java Server Pages Cons
Code and HTML are in the same file Java has a pretty steep learning curve
Java Server Pages Resources
http://www.serverpages.com/Java_Server_Pages http://java.sun.com/products/jsp/
Java Servlets
Free! (usually) Java Server API Code is compiled and saved on first use Available on many OS/Web Servers Java is very object oriented
Java Servlets Pros
API is pretty simple Code must be compiled before using Pretty portable The Servlet API can be overridden to provide
additional functionality
Java Servlets Cons
Sometimes a web server reset is required to load changed classes
Unless you use a third party package, HTML is in with the logic
Check out www.webmacro.orgCheck out www.webmacro.org
Java Servlet Resources
http://java.sun.com/ http://www.servletcentral.com/ - Online
magazine http://www.servlets.com/ http://www.webmacro.org/ - Separate HTML
from code
Enhydra App Server
Free! (pay version available) Java based with source code Proprietary web development model Automatic data mapping with optional business
logic layer Supports Servlets/Java Server Pages Supports EJB in Enterprise edition Available for many OS’s
Enhydra App Server
Enhydra Enterprise App Server
Enhydra App Server Pros
Very scalable even across OS’s Has built in data/object mapping Proprietary interface separates HTML from code Proprietary interface is based on WC3 DOM Also supports Java Servlets and JavaServer
Pages Can integrate with Jbuilder & Oracle Developer EJB support in Enterprise edition
Enhydra App Server Cons
Huge learning curve Proprietary UI development is difficult No commercial support yet Very little documentation Integrates with Jbuilder through Kelp add-on
Use JSP or Servlets with their Data
Objects and Business Objects!
Use JSP or Servlets with their Data
Objects and Business Objects!
Enhydra App Server Resources
http://www.enhydra.org/ http://www.lutris.com/
Enterprise Java Beans
A method for building business logic EJB Servers provide support for
– Transactions– Security– Database Connectivity
Deploy EJB’s on any compatible server without changing code*
* Assuming you didn’t use any proprietary features of a server.
Enterprise Java Beans
Used for very high-end applications Supported in many servers such as:
– Enhydra Enterprise Server– JRUN– Bea Weblogic– Gemstone/J– Persistence PowerTier for EJB– IBM Websphere– Jboss Open Source Server (www.jboss.org)– And others….
Current/Future tools
DHTML XML
– Server side– Client side
SOAP
DHTML
Dynamic HTML Composed of
– HTML 4.0– Cascading Style Sheets (optional)– A scripting language– Document Object Model
HTML 4.0
Standardized by W3C Organization Added <script> and <noscript> tags Added support for an event model Depreciated tags such as <font>
Cascading Style Sheets (CSS)
Allow increased flexibility in page layout Allows developer to separate form and content Level 1 supported in NS 4+ and IE 4+ NS & IE support different values for the
visibility attribute making cross-browser development more fun for us!
Scripting Languages
Netscape developed JavaScript Microsoft reverse engineered it and called it J-
Script The ECMA standardized it and calls it
ECMAScript-262 Microsoft also supports VBScript You can add PerlScript if you like Warning code may be different in NS & IE and will
need to be tested/debugged in both
Document Object Model
Standardized by the W3C Allows access to parts of a web page
programmatically by a scripting language <DIV> and <SPAN> tags are very important!
Uses for Dynamic HTML
Make web pages look nicer Allow developer to better use screen real
estate Provide client side logic such as form validation
Dynamic HTML Examples
Mouse overs Transitions Pop up menus Drag and drop Form validation
Dynamic HTML Resources
Dynamic HTML by Jeff Rule (Addison Wesley) http://www.ruleweb.com/ http://www.webreference.com/ http://www.htmlguru.com/
XML
Extensible Markup Language Specification developed by the W3C A simplified version of SGML Markup meta-language – a language for
describing markup languages W3C is now working on rewriting HTML using
XML
XML and data
HTML is great for describing how things should look:<strong>New York</strong>– But what is this???
XML is a way to put structured data in a text file
No presentation info – just data We can give our data meaning
Well-formed XML
<?xml version=‘1.0’?>
<Student>
<StudentID>999-88-7777</StudentID>
<Name>Bill Smith</Name>
<Email>[email protected]</Email>
<Transfer/>
</Student>
<?xml version=‘1.0’?>
<Student>
<StudentID>999-88-7777</StudentID>
<Name>Bill Smith</Name>
<Email>[email protected]</Email>
<Transfer/>
</Student>
Sharing XML
Problem: if everyone makes up their own tags, how will we ever agree on what the data means?
Answer: we need some rules We need a way to define our tags, plus any
relationships between them People who share this set of rules can exchange data
in a meaningful way This would be valid XML
DTD
Document Type Definition
<!-- ELEM NAME CONTENT MODEL --><!ELEMENT weather (city+) ><!ELEMENT city (name, report) ><!ELEMENT name (#PCDATA) ><!ELEMENT report (high, low, precip?) ><!ELEMENT high (#PCDATA) ><!ELEMENT low (#PCDATA) ><!ELEMENT precip EMPTY ><!ATTLIST precip day_total CDATA # REQUIRED
type (rain | snow) “rain”force (light | heavy) #IMPLIED >
<!-- ELEM NAME CONTENT MODEL --><!ELEMENT weather (city+) ><!ELEMENT city (name, report) ><!ELEMENT name (#PCDATA) ><!ELEMENT report (high, low, precip?) ><!ELEMENT high (#PCDATA) ><!ELEMENT low (#PCDATA) ><!ELEMENT precip EMPTY ><!ATTLIST precip day_total CDATA # REQUIRED
type (rain | snow) “rain”force (light | heavy) #IMPLIED >
<weather> <city> <name>Bloomington</name> <report> <high>76</high> <low>46</low> <precip day_total=“0” type=“rain” force=“light”/> </report> </city></weather>
<weather> <city> <name>Bloomington</name> <report> <high>76</high> <low>46</low> <precip day_total=“0” type=“rain” force=“light”/> </report> </city></weather>
Schemas
Schemas provide the same functionality as DTDs, but in an XML format:
<?xml version="1.0" ?>
- <!-- Generated by XML Authority. Conforms to XML Data subset for IE 5
--> -<Schema name="SIF" xmlns="urn:schemas-microsoft-com:xml-data" - xmlns:dt="urn:schemas-microsoft-com:datatypes">
- <ElementType name="K12Framework" content="eltOnly" order="one">
<element type="K12Register" />
</ElementType>
- <ElementType name="K12Register" content="eltOnly" order="seq">
<element type="Header" />
<element type="Source" />
</ElementType>
<?xml version="1.0" ?>
- <!-- Generated by XML Authority. Conforms to XML Data subset for IE 5
--> -<Schema name="SIF" xmlns="urn:schemas-microsoft-com:xml-data" - xmlns:dt="urn:schemas-microsoft-com:datatypes">
- <ElementType name="K12Framework" content="eltOnly" order="one">
<element type="K12Register" />
</ElementType>
- <ElementType name="K12Register" content="eltOnly" order="seq">
<element type="Header" />
<element type="Source" />
</ElementType>
Schema initiatives
There are lots of schemas already out there Most are industry specific No need to reinvent the wheel Check out www.biztalk.org
Name Collisions
What if somebody else is already using our tags???
We need a way to allow people to define unique tags and attributes and have them coexist in the same document
Namespaces solve this problem
Namespaces
<x xmlns:edi='http://ecommerce.org/schema'><!-- the 'price' element's namespace is http://ecommerce.org/schema --> <edi:price units='Euro'>32.18</edi:price>
</x>
<x xmlns:edi='http://ecommerce.org/schema'><!-- the 'price' element's namespace is http://ecommerce.org/schema --> <edi:price units='Euro'>32.18</edi:price>
</x>
XML Implementations
Parsers– Perl Parser based on expat found on CPAN– Xerces for for Java, Perl, C++ xml.apache.org– MSXML built into IE 5
Client Applications for XML
Pass datasets to a browser. Browser script can manipulate data (IE 4&5 only)
Client applications can retrieve XML data from a web server for processing
Server Applications for XML
Data can be stored in XML and combined with XSL on the server to create HTML to be sent to a browser
XML can be passed between applications
XML Resources
http://msdn.microsoft.com/xml http://xml.apache.org/ http://www.xml.com/ http://www.xmlmag.com/ http://www.ibm.com/xml
SOAP
Simple Object Access Protocol XML/HTTP based protocol for accessing
services in a platform-independent manner Implementations exist in COM, ASP, Java, Perl
and maybe other languages
Reasons for SOAP
Cross-Platform connectivity Cross-Language connectivity Object access through firewalls
SOAP Request
POST /StockQuote HTTP/1.1Host: www.stockquoteserver.comContent-Type: text/xml; charset="utf-8" Content-Length: nnnn SOAPAction: "Some-URI"
<SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/ SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <m:GetLastTradePrice xmlns:m="Some-URI"> <symbol>DIS</symbol> </m:GetLastTradePrice> </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
POST /StockQuote HTTP/1.1Host: www.stockquoteserver.comContent-Type: text/xml; charset="utf-8" Content-Length: nnnn SOAPAction: "Some-URI"
<SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/ SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <m:GetLastTradePrice xmlns:m="Some-URI"> <symbol>DIS</symbol> </m:GetLastTradePrice> </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
SOAP Response
HTTP/1.1 200 OKContent-Type: text/xml; charset="utf-8“Content-Length: nnnn
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <SOAP-ENV:Body> <m:GetLastTradePriceResponse xmlns:m="Some-URI"> <Price>34.5</Price> </m:GetLastTradePriceResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope>
HTTP/1.1 200 OKContent-Type: text/xml; charset="utf-8“Content-Length: nnnn
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <SOAP-ENV:Body> <m:GetLastTradePriceResponse xmlns:m="Some-URI"> <Price>34.5</Price> </m:GetLastTradePriceResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope>
SOAP Implementations
MS Visual Studio 6 Wizard Simon Fell’s COM server Java from the Apache Group Developmentor COM, VB, Perl implementation CPAN Perl SOAP-Lite
SOAP Resources
http://msdn.microsoft.com/xml http://www.develop.com/soap http://soap.weblogs.com/ http://www.zaks.demon.co.uk/com/index.html
Summary
There are many tools available for web development
Don’t overlook free tools! Learn DHTML and XML and use them in your
projects
Questions
??