introduction to web services protocols 1

Upload: writetoevv

Post on 04-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Introduction to Web Services Protocols 1

    1/33

    Introduction to Web Services

    Protocols

  • 7/30/2019 Introduction to Web Services Protocols 1

    2/33

    Talk title date 2

    Communication and standards

    Efficient (or indeed any)

    communication is dependent on ashared vocabulary and grammar.

    Because web services deals withinter-organisation communicationthese must be universal standards.

  • 7/30/2019 Introduction to Web Services Protocols 1

    3/33

    Talk title date 3

    Underlying standards

    The basic standards for web services are:

    XML (Extensible Markup Language)

    SOAP (simple object access protocol)

    WSDL (web services description language)

    UDDI (universal description, discovery andintegration)

  • 7/30/2019 Introduction to Web Services Protocols 1

    4/33

    Talk title date 4

    The state of standards

    XML 1.0 fairly stable, although Schema are in the processof replacing DTDs (currently Schema 1.1 being worked on).

    SOAP 1.2

    WSDL 2.0 (coming out, 1.2 current)

    UDDI version 3 (Aug 2003)

    BPEL 1.1 (Business Process Execution Language)choreography description language (web services workflows)

    started January 2003.

    Standards are still volatile and in the process of development.

  • 7/30/2019 Introduction to Web Services Protocols 1

    5/33

    Talk title date 5

    Web Services Architecture

    Web Services involve three majorroles

    Service Provider

    Service Registry

    Service Consumer

    Three major operations surround webservices

    Publishing making a service available

    Finding locating web services

    Binding using web services

  • 7/30/2019 Introduction to Web Services Protocols 1

    6/33

    Talk title date 6

    Making a service available (1)

    In order for someone to use your servicethey have to know about it.

    To allow users to discover a service it is

    published to a registry (UDDI).

    To allow users to interact with a service youmust publish a description of its interface

    (methods & arguments).

    This is done using WSDL.

  • 7/30/2019 Introduction to Web Services Protocols 1

    7/33

    Talk title date 7

    Making a service available (2)

    Once you have published a description of yourservice you must have a host set up to serve it.

    A web server is often used to deliver services(although custom application application

    communication is also possible).

    This is functionality which has to be added to theweb server. In the case of the apache web server acontainer application (Tomcat) can be used to make

    the application (servlet) available to apache(deploying).

  • 7/30/2019 Introduction to Web Services Protocols 1

    8/33

    Talk title date 8

    The old transfer protocols arestill there.

    Like the grid architecture webservices is layered on top of existing,mature transfer protocols.

    HTTP, SMTP are still used over TCP/IPto pass the messages.

    Web services, like grids, can be seenas a functionality enhancement to theexisting technologies.

  • 7/30/2019 Introduction to Web Services Protocols 1

    9/33

    Talk title date 9

    XML

    All Web Services documents arewritten in XML

    XML Schema are used to define theelements used in Web Servicescommunication

  • 7/30/2019 Introduction to Web Services Protocols 1

    10/33

    Talk title date 10

    SOAP

    Actually used to communicate with the WebService

    Both the request and the response are SOAP

    messages

    The body of the message (whose grammaris defined by the WSDL) is contained within

    a SOAP envelope

    Binds the client to the web service

  • 7/30/2019 Introduction to Web Services Protocols 1

    11/33

    Talk title date 11

    WSDL

    Describes the Web Service anddefines the functions that areexposed in the Web Service

    Defines the XML grammar to be usedin the messages

    Uses the W3C Schema language

  • 7/30/2019 Introduction to Web Services Protocols 1

    12/33

    Talk title date 12

    UDDI

    UDDI is used to register and look upservices with a central registry

    Service Providers can publish information

    about their business and the services thatthey offer

    Service consumers can look up services that

    are available by Business

    Service category

    Specific service

  • 7/30/2019 Introduction to Web Services Protocols 1

    13/33

    Talk title date 13

    Section

    XML

  • 7/30/2019 Introduction to Web Services Protocols 1

    14/33

    Talk title date 14

    What is XML

    XML stands for extensible markup language

    It is a hierarchical data description language

    It is a sub set of SGML a general documentmarkup language designed for the Americanmillitary.

    It is defined by w3c.

  • 7/30/2019 Introduction to Web Services Protocols 1

    15/33

    Talk title date 15

    How does XML differ fromHTML?

    HTML is a presentation markup language provides no information about content.

    There is only one standard definition of all of the

    tags used in HTML.

    XML can define both presentation style and giveinformation about content.

    XML relies on custom documents defining themeaning of tags.

  • 7/30/2019 Introduction to Web Services Protocols 1

    16/33

    Talk title date 16

    What is a Schema?

    A schema is the definition of the meaning ofeach of the tags within a XML document.

    Analogy: A HTML style sheet can be seen as

    a limited schema which only specifies thepresentational style of HTML which refers toit.

    Example: in HTML the tag pre-defined. In XML you would need to definethis in the context of your document.

  • 7/30/2019 Introduction to Web Services Protocols 1

    17/33

    Talk title date 17

    A minimal XML document

    Jim

    A tag

    An attribute

    value

    Closing tag

  • 7/30/2019 Introduction to Web Services Protocols 1

    18/33

    Talk title date 18

    Valid and well formedA correct XML document must be both valid

    and well formed.

    Well formed means that the syntax must becorrect and all tags must close correctly (eg

    ).

    Valid means that the document mustconform to some XML definition ( a DTD or

    Schema).

    (Otherwise there can be no definition of whatthe tags mean)

  • 7/30/2019 Introduction to Web Services Protocols 1

    19/33

    Talk title date 19

    Using namespaces in XML

    To fully qualify a namespace in XML write thenamespace:tag name. eg.

    In a globally declared single namespace the qualifier

    may be omitted.

    More than one namespace:

    can co-exist if correctly qualified.

  • 7/30/2019 Introduction to Web Services Protocols 1

    20/33

    Talk title date 20

    Namespaces in programminglanguages

    In C/C++ defined by #includes and classes(eg. myclass::variable).

    In PERL defined by package namespace,

    $local and $my (eg. myPackage::variable).

    In JAVA defined by includes and packagenamespace (eg. java.lang.Object)

    Defines the scope of variables

  • 7/30/2019 Introduction to Web Services Protocols 1

    21/33

    Talk title date 21

    Schema

    sam smith

    sam smith

    Simple schema

    saved as order.xsd

    XML document

    derived from

    schema.

  • 7/30/2019 Introduction to Web Services Protocols 1

    22/33

    Talk title date 22

    Section

    SOAP

  • 7/30/2019 Introduction to Web Services Protocols 1

    23/33

    Talk title date 23

    Request Response WebServices

    Currently the most common implementationof Web Services

    Work in a very simple request response

    paradigm

    For Example: A Weather Service simple request for weather in an area, simple

    response with the weather report

    An Airline special offers service travel agents would simply makerequests for latest offers and would receive the offers as aresponse

  • 7/30/2019 Introduction to Web Services Protocols 1

    24/33

    Talk title date 24

    SOAP messagesSOAP provides a standard envelope within

    which a message can be delivered.

    SOAP is mechanism (protocol) fortransferring information (messages)

    between applications which may be widelydistributed.

    SOAP says nothing about the content of the

    message the sender and the receiver mustunderstand the message for themselves.

    SOAP is part of a communication stack.

  • 7/30/2019 Introduction to Web Services Protocols 1

    25/33

    Talk title date 25

    SOAP Structure(1)

    Each SOAP messagewill have:

    An Envelope

    A Header (optional)

    A Body

    The Body may containa Fault element

    SOAP BODY

    SOAP ENVELOPE

    FAULT

    SOAP HEADER

    Transport protocol

    MIME header

  • 7/30/2019 Introduction to Web Services Protocols 1

    26/33

    Talk title date 26

    SOAP Structure(2)

    The envelope wraps the entire soap document

    The header contains allows additional information tobe passed as well as the body of the document e.g.authentication

    The body element contains the core of the SOAPdocument this will contain either the RPC call orthe XML message itself

    The fault information will contain any exceptioninformation

  • 7/30/2019 Introduction to Web Services Protocols 1

    27/33

    Talk title date 27

    Anatomy of a SOAP message

  • 7/30/2019 Introduction to Web Services Protocols 1

    28/33

    Talk title date 28

    SOAP protocol binding

    SOAPAction = urn:soaphttpclient-action-uri

    Host = localhost

    Content-Type = text/xml; charset=utf-8

    Content-Length = 701

  • 7/30/2019 Introduction to Web Services Protocols 1

    29/33

    Talk title date 29

    SOAP RPC

    SOAP RPC messages contain XML thatrepresents a method call or methodresponse

    The SOAP XML will be converted intoa method call on the server and theresponse will be encoded into SOAP

    XML to be returned to the client

  • 7/30/2019 Introduction to Web Services Protocols 1

    30/33

    Talk title date 30

    SOAP Faults

    SOAP errors are handled using aspecialised envelope known as a FaultEnvelope

    A SOAP Fault is a special elementwhich must appear as an immediatechild of the body element

    and arerequired.

  • 7/30/2019 Introduction to Web Services Protocols 1

    31/33

    Talk title date 31

    A SOAP fault

    SOAP-ENV:Server

    Test fault/soap/servlet/rpcrouter

    ..

  • 7/30/2019 Introduction to Web Services Protocols 1

    32/33

    Talk title date 32

    SOAP Attachment

    Large quantities orbinary data may not fitwell into a XML SOAPmessage.

    In which case it can besent out of band byattaching it to a SOAP

    message

    Analogy : emailattachments.

    SOAP BODY

    SOAP ENVELOPE

    FAULT

    SOAP HEADER

    Transport protocol

    MIME header

    Attachment

  • 7/30/2019 Introduction to Web Services Protocols 1

    33/33

    Talk title date 33

    Attaching a file to a SOAPmessage

    To add a file to a SOAP message a tagis added within the body of themessage.