Web Architecture SCJ UTM

Embed Size (px)

Citation preview

  • 7/28/2019 Web Architecture SCJ UTM

    1/84

    Basic WEB Architecture

    1

  • 7/28/2019 Web Architecture SCJ UTM

    2/84

    Data Driven WEB Architecture

    2

  • 7/28/2019 Web Architecture SCJ UTM

    3/84

    Recent WEB Applications Architecture

    3

  • 7/28/2019 Web Architecture SCJ UTM

    4/84

    Client Tier

    4

  • 7/28/2019 Web Architecture SCJ UTM

    5/84

    Service Tier

    5

  • 7/28/2019 Web Architecture SCJ UTM

    6/84

    The Web as a Platform

    for Running Applications

    6

  • 7/28/2019 Web Architecture SCJ UTM

    7/84

    Service Oriented Application (SOA)

    7

  • 7/28/2019 Web Architecture SCJ UTM

    8/84

    Service Oriented Application (SOA)

    8

  • 7/28/2019 Web Architecture SCJ UTM

    9/84

    Service Oriented Application (SOA)

    9

  • 7/28/2019 Web Architecture SCJ UTM

    10/84

    Service Oriented Application (SOA)

    10

  • 7/28/2019 Web Architecture SCJ UTM

    11/84

    Service Oriented Application (SOA)

    11

  • 7/28/2019 Web Architecture SCJ UTM

    12/84

    Front-End

    12

  • 7/28/2019 Web Architecture SCJ UTM

    13/84

    Front-End

    13

  • 7/28/2019 Web Architecture SCJ UTM

    14/84

    Service Oriented Application (SOA)

    14

  • 7/28/2019 Web Architecture SCJ UTM

    15/84

    Middle Layer Data Link

    15

  • 7/28/2019 Web Architecture SCJ UTM

    16/84

    Service Oriented Application (SOA)

    16

  • 7/28/2019 Web Architecture SCJ UTM

    17/84

    Back-End- Server Site

    17

  • 7/28/2019 Web Architecture SCJ UTM

    18/84

    GROUP DISCUSSION

    18

    W

    H

    A

    T

    T

    O

    D

    O?

  • 7/28/2019 Web Architecture SCJ UTM

    19/84

    What is XML?

    eXtensible Markup Language, is aspecification for creating custom markup

    languages

    W3C RecommendationPrimary purpose is to help computers to share

    data

    XML is meta-language. This means that youuse it for creating languages.

    XML is an extensive concept.

  • 7/28/2019 Web Architecture SCJ UTM

    20/84

    XML Document

    Every XML-document is text-based=> sharing data between different computers!

    => sharing data in Internet!

    => platform independence!

  • 7/28/2019 Web Architecture SCJ UTM

    21/84

    Binary vs. Text

    Problems with Binary format Platform depence

    Firewalls

    Hard to debug Inspecting the file can be hard

    Since XML is text-based, it does not have the

    problems mentioned above.What are the disadvantages in text format?

  • 7/28/2019 Web Architecture SCJ UTM

    22/84

    XML Doc Advantages

    Easy data sharing, text documents are readablebetween any device.

    Documents can be modified with any text editor.

    Possible to understand the contents of the xml-

    document just by looking at it with text editor.Easy to manipulate via programming languages

    Two levels of correctness: Well formed and Valid.

  • 7/28/2019 Web Architecture SCJ UTM

    23/84

    .doc file format

    Windows

    MS Word 2000Mac OS X

    Since .doc is closed binary-format,

    there are very few alternatives for

    word processors that fully support

    the docfile format

    0101011010101010001010

    1010101110101010001011

    1010101110101010110101

    1110101010101010101010

    d fil f t (Offi O

  • 7/28/2019 Web Architecture SCJ UTM

    24/84

    .docx file format (Office Open

    XML)

    Windows

    MS Word 2007Mac OS X

    Hopefully in the future there

    will be loads of free programs

    that support this new open

    and easy access file format

    title

    .

    .

    Now the format is

    open and it's much

    easier to access

  • 7/28/2019 Web Architecture SCJ UTM

    25/84

    SGML vs. XML

    SGML: Standard Generalized Markup Language

    XML

    HTML

    (.html)

    XHTML

    (.xhtml)

    MathML

    (.mml)

    OOXML

    (.docx)

  • 7/28/2019 Web Architecture SCJ UTM

    26/84

    XML Meta Language

    XML is meta language, which you can use to createyour own markup languages.

    There are several XML Markup Languages made fordifferent purposes

    All the languages have common xml-rulesLanguages: XHTML, OOXML, Open Document,

    RSS, SVG, SOAP, SMIL, MathML...

    List: http://en.wikipedia.org/wiki/List_of_XML_markup_languages

  • 7/28/2019 Web Architecture SCJ UTM

    27/84

    XHTML - Example

    Minimal XHTML 1.0 Document

    This is a minimal XHTML 1.0

    document.

  • 7/28/2019 Web Architecture SCJ UTM

    28/84

    SVG - Example

  • 7/28/2019 Web Architecture SCJ UTM

    29/84

    MathML (Open Office)

    x=

    ...

    x = {-b +-sqrt{b^{2}-4{ac}} } over {2 {a}}

  • 7/28/2019 Web Architecture SCJ UTM

    30/84

    RSS 2.0 - Example

    W3Schools Home Page

    http://www.w3schools.com

    Free web building tutorials

    RSS Tutorialhttp://www.w3schools.com/rss

    New RSS tutorial on W3Schools

    XML Tutorial

    http://www.w3schools.com/xmlNew XML tutorial on W3Schools

  • 7/28/2019 Web Architecture SCJ UTM

    31/84

    XML Editors

    XML SpyEditiX

    Microsoft XML Notepad

    Visual XML

    XML Viewer

    Xeena

    XML Styler, Morphon, XML Writer

  • 7/28/2019 Web Architecture SCJ UTM

    32/84

    WELL FORMED XML -DOCUMENT

    Rules that Apply to Every XML-Document

  • 7/28/2019 Web Architecture SCJ UTM

    33/84

    Correctness

    There are two levels of correctness of an XMLdocument:

    1. Well-formed. A well-formed document conforms

    to all of XML's syntax rules.

    2. Valid. A valid document additionally conforms to

    some semantic rules.

    Let's first look at the XML's syntax rules (1).

  • 7/28/2019 Web Architecture SCJ UTM

    34/84

    Simple Generic XML Example

    Introduction to XML

    XML is ...

  • 7/28/2019 Web Architecture SCJ UTM

    35/84

    XML-Declaration

    XML-declaration is optional in XML 1.0, mandatoryin 1.1. Recommendation: use it.

    Version: 1.0 or 1.1

    Encoding: character encoding, default utf-8Standalone:

    is the xml-document linked to external markup declaration

    yes: no external markup declarations

    no: can have external markup declaration (open issue..) default: "no"

  • 7/28/2019 Web Architecture SCJ UTM

    36/84

    Comparing Declarations

    Introduction to XML

    XML is ...

    Introduction to XML

    XML is ...

    Same Declaration

  • 7/28/2019 Web Architecture SCJ UTM

    37/84

    Element vs. Tag vs. Attribute

    Element consists ofstart tag, optional contentand anend tag: Introduction to XML

    Start tag

    Content Introduction to XML

    End tag

    Start tag may have attribute

  • 7/28/2019 Web Architecture SCJ UTM

    38/84

    Rules about Elements

    Only one root - element

    Every element contains starting tag and an ending tag

    Content is optional: Empty element

    Tag names are case-sensitive:

    Elements must be ended with the end tag in correct order:

    problem here

  • 7/28/2019 Web Architecture SCJ UTM

    39/84

    Rules about Attributes

    XML elements can have attributes in thestart tag.

    Attributes must be quoted:

  • 7/28/2019 Web Architecture SCJ UTM

    40/84

    Naming Tags

    Names can contain letters, numbers, and othercharacters

    Names must not start with a number or

    punctuation characterNames must not start with the letters xml (or

    XML, or Xml, etc)

    Names cannot contain spaces

  • 7/28/2019 Web Architecture SCJ UTM

    41/84

    Well-Formed XML

    XML document is well-formed if it follows thesyntax rules.

    XML document must be well-formed!

    it's not an xml-document, if it does not follow therules..

    Is this Well-Formed XML

  • 7/28/2019 Web Architecture SCJ UTM

    42/84

    Is this Well-Formed XML

    Document?

    Minimal XHTML 1.0 Document

    This is a minimal XHTML 1.0document.

    Is this Well-Formed XML

  • 7/28/2019 Web Architecture SCJ UTM

    43/84

    Is this Well-Formed XML

    Document?

    Minimal XHTML 1.0 Document

    This is a minimal XHTML 1.0document.

  • 7/28/2019 Web Architecture SCJ UTM

    44/84

    VALID XML DOCUMENT

    Defining the Structure for XML documents

  • 7/28/2019 Web Architecture SCJ UTM

    45/84

    Valid XML

    XML document is valid if 1) It is well formed AND

    2) It follows some semantic rules

    XML document is usually linked to an external file,

    that has semantic rules for the document. The file can be dtd (.dtd) or schema (.xsd)

    Semantic rules?

    Name of tags, order of elements

  • 7/28/2019 Web Architecture SCJ UTM

    46/84

    DTD Linking

    Minimal XHTML 1.0 Document

    This is a minimal XHTML 1.0

    document.

    Rules for XHTML elements (order,

    names, etc)

  • 7/28/2019 Web Architecture SCJ UTM

    47/84

    DTD Linking

    Defines the structure, tag names and

    order for all xhtml - documents

    W3C has created XML-language "XHTML"

    by defining it's rules in DTD.

  • 7/28/2019 Web Architecture SCJ UTM

    48/84

    Is this valid XML Document?

    Minimal XHTML 1.0 Document

    This is a minimal XHTML 1.0document.

    1. There is no DTD! What language is this? MathML? SVG? XHTML?

    2. Assuming this is XHTML, what version of XHTML? Transitional? Strict?

    3. Assuming this is XHTML strict, does "jorma" tag belong to XHTML Language?

  • 7/28/2019 Web Architecture SCJ UTM

    49/84

    Invalid XHTML-document

    Minimal XHTML 1.0 Document

    This is a minimal XHTML 1.0

    document.

    C S

  • 7/28/2019 Web Architecture SCJ UTM

    50/84

    Validating with W3C Service

    I lid XHTML i B ?

  • 7/28/2019 Web Architecture SCJ UTM

    51/84

    Invalid XHTML in Browser?

    May work... or not. Browser tries to detect the errors and tries to understand

    them. If it works with one browser, are you certain that it works with all other

    browsers? And with all the versions with the browsers? What about browsers

    in handheld devices?

    And it might work now, but what about future? How will Firefox 5.0 handle

    incorrect web pages?

    I lid XML i G l

  • 7/28/2019 Web Architecture SCJ UTM

    52/84

    Invalid XML in General

    Because of HTML heritage, browsers try tounderstand invalid XHTML-pages

    This is not the case in other XML-languages.

    In general, if XML-document is invalid, theprocessing of the document is cancelled.

  • 7/28/2019 Web Architecture SCJ UTM

    53/84

    JavaScript Object Notation

    (JSON)

    JSON

  • 7/28/2019 Web Architecture SCJ UTM

    54/84

    JSON

    JSON (JavaScript Object Notation) is a lightweightdata-interchange format.

    It is easy for humans to read and write.

    It is easy for machines to parse and generate.

    It is based on a subset of the JavaScriptProgramming Language, Standard ECMA-262 3rdEdition - December 1999.

    JSON is a text format that is completely language

    independent.These properties make JSON an ideal data-

    interchange language.

    Wh JSON?

  • 7/28/2019 Web Architecture SCJ UTM

    55/84

    Why JSON?

    Because JSON is lightweight, easy to understand,manipulate and generate, it has almost replaced XMLwhich was used previously as the only data-interchange format.

    JSON is preferable because of the following reasons:

    XML is heavier than JSON to parse XML, we have to use xPath which is an overhead

    removed in JSON because JSON is native to JavaScript

    XML uses tags to describe user data and tags increase thesize of data

    JSON St t

  • 7/28/2019 Web Architecture SCJ UTM

    56/84

    JSON Structures

    JSON is built on two structures:A collection of name/value pairs.

    In various languages, this is realized as an object,

    record, dictionary, hash table, keyed list, or associative

    array.

    An ordered list of values.

    In most languages, this is realized as an array, vector,

    list, or sequence.

    S t f JSON

  • 7/28/2019 Web Architecture SCJ UTM

    57/84

    Syntax of JSON

    ObjectAn objectis an unordered set of name/value pairs.

    An object begins with { (left brace) and ends with } (right

    brace). Each name is followed by : (colon) and the name/value pairs

    are separated by , (comma).

    S t f JSON

  • 7/28/2019 Web Architecture SCJ UTM

    58/84

    Syntax of JSON

    Array

    An arrayis an ordered collection of values.

    An array begins with [ (left bracket) and ends with ] (right

    bracket). Values are separated by , (comma).

    S t f JSON

  • 7/28/2019 Web Architecture SCJ UTM

    59/84

    Syntax of JSON

    A value can be a stringin double quotes, or anumber, or true or false or null, or an objector

    an array. These structures can be nested.

    A stringis a collection of zero or more Unicodecharacters, wrapped in double quotes, using

    backslash escapes. A character is represented

    as a single character string. A string is very

    much like a C or Java string.

    JSON E l

  • 7/28/2019 Web Architecture SCJ UTM

    60/84

    JSON Example

    { students :[

    {id":1, "name":"Adnan Sohail"},

    {id":2, "name":"Irfan Razzaq"}]

    }

    XML Example

  • 7/28/2019 Web Architecture SCJ UTM

    61/84

    XML Example

    1

    Adnan Sohail

    2

    Irfan Razzaq

    Validating JSON &

  • 7/28/2019 Web Architecture SCJ UTM

    62/84

    gJSON Security

    JavaScripts built-in method eval() is used to validatea JSON string.

    Note:

    Use eval() only when the source is authentic and trusted

    which means use it only if you are sure that the stringpassed to it is a valid JSON string

    When youve security risks usevar myObject = myJSONtext.parseJSON();

    Which is available in http://www.json.org/json.js

    but eval() is faster than parseJSON()

    Using JSON APIs

    http://www.json.org/json.jshttp://www.json.org/json.js
  • 7/28/2019 Web Architecture SCJ UTM

    63/84

    Using JSON APIs

    JSON strings can be easily generated using JSONAPIs available at http://json.org

    There are two main classes available in org.json.*

    package

    org.json.JSONObject

    org.json.JSONArray

    Strings can be generating from objects ofJSONObject orJSONArray using their

    toString() methods

    Benefits of JSON over XML

    http://json.org/http://json.org/
  • 7/28/2019 Web Architecture SCJ UTM

    64/84

    Benefits of JSON over XML

    JSON supports data types like string, integer,boolean etc.

    JSON is native data format for JavaScript and

    therefore it faster for the browser to read and

    understand.As JSON contains no tags but data and therefore

    less data to be transferred between client and the

    server. So, its lighter than XML.

    Easy for humans to read and write.

    JSON References

  • 7/28/2019 Web Architecture SCJ UTM

    65/84

    JSON References

    http://www.xul.fr/en-xml-ajax.htmlhttp://www.xul.fr/ajax-javascript-json.html

    http://json.org/

    http://www.json.org/java/

  • 7/28/2019 Web Architecture SCJ UTM

    66/84

    WEB SERVICE DESCRIPTION

    LANGUAGE (WSDL)

    I t d ti

  • 7/28/2019 Web Architecture SCJ UTM

    67/84

    Introduction

    WSDL is an XML language that contains

    information about the interface semantics andadministrivia of a call to a Web Service

    Once you develop a Web Service you publishits description and a link to it in a UDDI

    repository so that potential users can find itWhen someone wants to use your service,

    they request the WSDL file in order to find outthe location of the service, the function calls

    and how to access themThen they use this information in your WSDL

    file to form a SOAP request to the computer

    Definitions

  • 7/28/2019 Web Architecture SCJ UTM

    68/84

    Definitions

    Definitions:- WSDL is an XML-based language used to

    define Web Services and describe how to

    access them.

    - WSLD is an XML format for describingnetwork services as a set of endpoints

    operating on messages containing either

    document-oriented or procedure-oriented

    information.

    Working of WSDL

  • 7/28/2019 Web Architecture SCJ UTM

    69/84

    Working of WSDL

    Figure 1. A client invoking a Web service.

    Working of WSDL contd

  • 7/28/2019 Web Architecture SCJ UTM

    70/84

    Working of WSDL contd.

    Figure 2. WSDL terminology used for describing Web services.

    Working of WSDL (with Java)

  • 7/28/2019 Web Architecture SCJ UTM

    71/84

    Working of WSDL (with Java)

    contd.

    Where does it fit in?

  • 7/28/2019 Web Architecture SCJ UTM

    72/84

    Where does it fit in?

    Wh t i UDDI?

  • 7/28/2019 Web Architecture SCJ UTM

    73/84

    What is UDDI? Universal Description Discovery and Integration

    Industry-wide initiative supporting web services

    Specifications Schemas for service description

    Schemas for business (service implementers)description

    Developed on industry standards (XML, HTTP, TCP/IP,SOAP)

    Applies equally to XML and non-XML web services

    Implementation Public web service registry and development

    resources

  • 7/28/2019 Web Architecture SCJ UTM

    74/84

    Industry-Wide Project Support

    All major technology providers

    Global corporations

    Strong resource and product commitment

    Roadmap for transition to standards body

    Unprecedented collaboration

    XML and Web Services recognized as core standards Competition on services built on a common model

    Technology, platform, and development languageneutral

    What Problems Do We Solve?

  • 7/28/2019 Web Architecture SCJ UTM

    75/84

    What Problems Do We Solve?An organization needs to

    create 400 electronic

    relationships with

    partners, each with itsown standards and

    protocols

    Broader

    B2B

    A small business wants to

    be plugged in to every

    marketplace in the world,

    but doesnt know how

    Smarter

    Search

    A B2B marketplace cannot

    get catalog data for

    relevant suppliers in its

    industry, along with

    connections to shippers,insurers, etc.

    Easier

    Aggregation

    DescribeServices

    Discover

    Services

    Integrate

    Them

    Together

    Provide a standards-based

    profile for all electronic

    services that are provided.

    Includes web sites, other

    electronic resources

    Web Service

    Visibility

    Publ ish for

    Accessibi l i ty

    Foundation for Web Services

  • 7/28/2019 Web Architecture SCJ UTM

    76/84

    Foundation for Web Services

    Ubiquitous Communications: Internet

    Universal Data Format: XML

    Service Interactions: SOAP

    Formal Service Descriptions: WSDL

    Broad Industry Support, Simple Process

    Publish and Discover Services: UDDI

  • 7/28/2019 Web Architecture SCJ UTM

    77/84

    UDDI Registry Entries

    Standards Bodies,Agencies, Programmers,Publishers registerspecifications for theirService Types

    Service providers registerprecise information about

    themselves and their Webservices

  • 7/28/2019 Web Architecture SCJ UTM

    78/84

    Business name

    General business description

    Any number of languages

    Contact info

    Names, phone numbers,

    fax numbers, web sites, etc.

    Known identifiers

    List of unique identifiers for a business

    D-U-N-S, Thomas, domain name, stock ticker

    symbol, other

  • 7/28/2019 Web Architecture SCJ UTM

    79/84

    Business categories

    3 base taxonomies in V1

    Industry: NAICS (Industry codes - US Govt.) Product/Services: UNSPSC (ECCMA)

    Location: Geographical taxonomy (ISO 3166)

    easy extension in upcoming releases

  • 7/28/2019 Web Architecture SCJ UTM

    80/84

    New set of information businesses useto describe how to do e-commerce

    with them

    Nested model Business process (functional)

    Service specifications (technical)

    Binding information (implementation)

    Programming/platform/

    implementation agnostic

    Services can also be categorized

    How UDDI Works

  • 7/28/2019 Web Architecture SCJ UTM

    81/84

    How UDDI Works

    UDDI Registry

    3.UDDI Registry assigns a programmatically

    unique identifier to each service andregistration

    Marketplaces, search

    engines, and business

    applications query the

    registry to discover services

    at other companies and to

    facilitate integration

    4.

    Service Types

    1.

    ImplementationsImplementers

    populate the

    registry withdescriptions of

    their businesses

    and the services

    they expose

    2.

    Large businesses

    apply the same

    architecture and

    technologies internally

    5.

    Software companies, standards

    bodies, and developers populate

    the registry with descriptions(specifications) of types of

    services

    Public Registry Operation

  • 7/28/2019 Web Architecture SCJ UTM

    82/84

    Public Registry Operation

    IBM

    HP (planned)

    Microsoftother

    other

    Peer registry nodes (websites)

    Information registered

    with any node

    Registrations replicated

    on a daily basis

    Complete set ofregistered records

    available at all nodes

    Common set of

    SOAP APIs supported

    by all nodes Compliance enforced

    by business contract

    All technologies applied

    Interoperabilityverified constantly

    UDDI.org

    queries

    Applications

    Marketplaces

    End Users

    Developers

    UDDI and SOAP

  • 7/28/2019 Web Architecture SCJ UTM

    83/84

    UDDI and SOAP

    User

    UDDISOAP Request

    UDDI

    SOAP Response

    UDDI RegistryNode

    HTTPServer

    SOAPProcessor

    UDDIRegistry Service

    B2B DirectoryCreate, View,Update, and Delete

    registrations Implementation-neutral

    GROUP DISCUSSION

  • 7/28/2019 Web Architecture SCJ UTM

    84/84

    GROUP DISCUSSION

    W

    H

    A

    T

    T

    O

    D

    O

    ?