44
Lecture 4 Middleware: Client-Server Computing Wireless and Mobile Systems Design

Lecture 04 Client Server

  • Upload
    sumancy

  • View
    220

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 1/44

Lecture 4Middleware: Client-Server 

Computing

Wireless and Mobile Systems Design

Page 2: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 2/44

Middleware: Client-Server Computing2

Lecture Objectives

● Differentiate and exemplify client-server,client-agent-server, and client-intercept-server 

models of middleware

● Understand functionality provided by middleware for 

client, agent, and server software development● Understand how the client-server computational

model middleware is able to deal with heterogeneous

wireless devices and scalability

● Characterize the design requirements of exampleclient-server applications and rationalize the choice

of middleware and design for application

development

Page 3: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 3/44

Middleware: Client-Server Computing3

Resources

● H. Gunzer, “Introduction to Web Services,” March2002, http://bdn.borland.com/article/images/28818/

webservices.pdf 

● Microsoft Developer Network, “Web Services

Basics,” http://msdn.microsoft.com/webservices/understanding/webservicebasics/

Page 4: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 4/44

Middleware: Client-Server Computing4

Agenda

● Client-server and middleware overview● Client-server computational models

■ Client-server 

■ Client-agent-server 

■ Client-intercept-server ● Web services overview

● Web services based on Extensible Markup Language

(XML) for mobile devices

■ Small Object Access Protocol (SOAP)■ Web Service Description Language (WSDL)

Page 5: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 5/44

Middleware: Client-Server Computing5

Middleware (Review)

● Middleware is a layer between the operating systemand applications that provides a set of services■ Abstract interface to the application

■ Uniform view of operating systems, networks, and hardware

platforms

Operating System

and Networking Services

Middleware

Application ProgramsAPI

Page 6: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 6/44

Middleware: Client-Server Computing6

Client-Server Computing

Client-Server vs. Peer-to-Peer 

Server 

• Client initiates

communications

• Client issues requestto a server 

• Server replies or 

performs some service

Peer-to-Peer Computing

• Any participant can

initiate communication

• Any device cangenerate a request

• Any device may

provide a response

Page 7: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 7/44

Middleware: Client-Server Computing7

Client-Server Models for Middleware

● Client-server ● Client-agent-server 

● Client-intercept-server models

Page 8: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 8/44

Middleware: Client-Server Computing8

Client-Server Model (1)

● Communication models■ Message passing with queuing

■ Remote procedure call (RPC)

● Client-server synchronization

■ Synchronous○ Inadequate – Client is blocked if disconnected

■ Asynchronous

○ Client requests are queued locally and control is returned

immediately to the client

○ When the mobile is connected, the queue is drained in

the background and any queued messages or calls are

forwarded to the server 

Page 9: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 9/44

Middleware: Client-Server Computing9

Mobile Host

Client-Server Model (2)

● Optimization for mobile/wireless involves changes at

both the client and server ● Example (worst-case)

■ Standard web browser accessing an HTTP server over a

wireless link

ApplicationClient

Application

Server 

FixedNetworkWirelessNetwork

Page 10: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 10/44

Middleware: Client-Server Computing10

Client-Agent-Server Model (1)

● Computation is split into two units■ Client-agent – optimized for mobile environment

■ Agent-server –traditional (non-mobile) design

● Dealing with disconnection

■ Clients submit requests to the agent and retrieve responsesfrom the agent upon reconnection

■ The agent can employ optimization and transformation

techniques to the data to be transmitted depending, based

on

○ Type of data○ Type of devices

○ Application-specific requirements

Page 11: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 11/44

Middleware: Client-Server Computing11

Client-Agent-Server Model (2)

● Optimization for mobile/wireless involves client and

agent

● Single application server to support both fixed

network clients and mobile clients

Mobile Host

ApplicationClient

Application

Server 

FixedNetwork

WirelessNetwork

Agent

Page 12: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 12/44

Middleware: Client-Server Computing12

Client-Agent-Server Example

● Wireless Application Protocol (WAP)■ Mobile device runs the client

■ The gateway acts as the agent

■ Standard HTTP server can be used

Client

Web

Browser 

Server 

HTTP

Server 

CGI,

etc.

Gateway

Encoders

Decoders

encodedrequest

encoded

response

request

responseProtocol

Gateways

wireless

Page 13: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 13/44

Middleware: Client-Server Computing13

Client-Intercept-Server Model (1)

● Inter-agent optimization protocols can be usedbetween the client-side agent and the server-side

agent■ Minimize communication cost via…

Caching○ Differencing

○ Header reduction

○ One-HTTP connection per session

● Caching/prefetching at the client agent to allow

disconnected operations■ For example, ADO .NET/SQL server CE

Page 14: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 14/44

Middleware: Client-Server Computing 14

Client-Intercept-Server Model (2)

Example – IBM Web Express■ Web Browser (client)↔ HTTP↔ Client-side agent↔ TCP/IP

connection↔ Server side agent↔ HTTP↔ Web server 

Mobile Host

Application

Server 

FixedNetwork

WirelessNetwork

AgentClient

Client

Side

Agent

Page 15: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 15/44

Middleware: Client-Server Computing 15

Web Services

● Web Services are encapsulated, loosely coupledcontracted functions offered via standard protocols

where:■ Encapsulated – implementation of the function is never seen

from the outside

■ Loosely coupled – changing the implementation of one

function does not require change of the invoking function

■ Contracted – there are publicly available descriptions of the

function’s behavior, how to bind to the function, and its

input and output parameters

From webservices.org, quoted in H. Gunzer, “Introduction to Web Services

Page 16: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 16/44

Middleware: Client-Server Computing 16

Web Services Architecture (1)

Service

Broker 

Service

Provider 

Service

Requester 

inquire publish

bind

Page 17: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 17/44

Middleware: Client-Server Computing 17

Web Services Architecture (2)

● Service broker ■ Look up service between a service provider and a service

requestor 

● Service provider ■

Publishes its services to the service broker ● Service requester 

■ Asks the service broker where to find a suitable service

provider and then binds itself to the provider 

Page 18: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 18/44

Middleware: Client-Server Computing 18

Web Services Components

● XML – Extensible

Markup Language

● SOAP – Simple Object

Access Protocol● WSDL – Web Services

Definition Language

● UDDI – Universal

Discovery Description

Integration

UDDI

WSDL

SOAP

XML

HTTP FTP SMTPWebServ

i ces

XML normally

carried using

HTTP

UDDI is the

“yellow pages”of web services

Page 19: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 19/44

Middleware: Client-Server Computing 19

Extensible Markup Language (XML)

● XML is a platform-neural data standard for describing, storing and transporting data across the

web

● XML is a core technology for web services

■ XML is the basis for separately developed web services tointeract with each other 

■ XML facilitates component development

○Package application functionality as small, easily

connected web services

○Compose an application using “web services”components

Page 20: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 20/44

Middleware: Client-Server Computing 20

XML and Microsoft’s .NET

● .NET is a Microsoft technology to develop XML webservices on many platforms■ .NET Active Server Page (ASP) – used to develop web

services

■ .NET Compact Framework (CF) – used to develop web

services on small devices

■ Microsoft Internet Toolkit (MIT) – used to develop server-

side proxies to deal with heterogeneous mobile devices

Page 21: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 21/44

Middleware: Client-Server Computing 21

XML and Wireless Web Access (1)

● The synergy between XML and wireless can beconsidered from two perspectives:■ XML as a data representation technology

■ XML as a meta-language (a set of rules to define domain-

specific data definition languages)

● XML as a data representation technology■ Facilitates content delivery (via XML transformation) to a

wide variety of mobile devices and platforms

Page 22: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 22/44

Middleware: Client-Server Computing 22

XML and Wireless Web Access (2)

● XML as a meta-language■ Key to the success of XML-based wireless web access

initiatives

■ WML – XML-compliant language used by WAP 1.0

■ XHTML – XML-compliant language adopted by WAP 1.2 and

future i-mode

■ Web Service Description Language (WSDL) – XML-compliant

language normally used in a WSDL document to describe a

web service’s interface

○ Provides clients with information on how to invoke a web

service

Page 23: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 23/44

Middleware: Client-Server Computing 23

XML Transformation

● XML separates the datafrom a fixed description

of how the data should

be displayed

Extensible Style-SheetLanguage (XLS)

describes how to

display content

XSLT is a scheme totransform XML data into

device-specific formats

XML

WML

XHTML

cHTML

XSLT

Page 24: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 24/44

Middleware: Client-Server Computing 24

XSLT to Target XML to Different Devices

WML

cHTML

PDA-specific

<?xml version=‘1.0’?>

<response id=“Result”>

<classECE/CS 4984

</class>

<price>

Invaluable

</price>

</response>

XSLT

for WAP

XSLT

for i-mode

XSLT

for PDA

XSLT

Engine

Page 25: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 25/44

Middleware: Client-Server Computing 25

SOAP for Invoking Web Services (1)

● Small Object Access Protocol (SOAP) is a standardfor invoking XML web services through remote

procedure calls over HTTP

● Used by Microsoft’s .NET■

.NET Compact Frame implements SOAP 1.1 to allow smartdevices to establish connections and move data to other 

devices

UDDI

WDSLSOAP

XML

Page 26: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 26/44

Middleware: Client-Server Computing 26

SOAP for Invoking Web Services (2)

● To make a method call to a web service…■ Client first learns the service interface via the server’s Web

Services Description Language (WSDL) document

■ Client then sends a request to the URL where the service is

running in a SOAP message in XML format for the RPC

UDDI

WDSLSOAP

XML

Page 27: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 27/44

Middleware: Client-Server Computing 27

SOAP and WSDL

● WSDL document specifies■ The name of the method to be invoked

■ The namespace Universal Resource Identifier (URI) for the

method name

○ A namespace is a unique string to fully qualify XML

element and attribute names

■ The parameter names and their data types

■ The SOAPAction

○ Placed in the HTTP header that the client sends when it

invokes the service■ The URL at which the service is running

Page 28: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 28/44

Middleware: Client-Server Computing 28

Accessing Web Services

From http://www.learnxmlws.com/tutors/wsdl/wsdl.aspx 

Middleware: Client-Server Computing

Page 29: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 29/44

Middleware: Client-Server Computing 29

WSDL for Defining Web Services

● WSDL is an XML-based language used to…■ Define a web service

■ Describe how to access methods provided by the service

UDDI

WDSL

SOAPXML

Page 30: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 30/44

Middleware: Client-Server Computing 30

Example: WSDL of a Weather Service

● <definitions> element is the root element of the

WSDL document

● Declare the WSDL name space as the default name

space for the document■ All elements and attributes belong to this name space

unless they have another name space prefix

● Each service is defined using a service element

<definitions name ='weatherservice'xmlns='http://schemas.xmlsoap.org/wsdl/'>

<service name='WeatherService' >

</service>

</definitions>

Page 31: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 31/44

Middleware: Client-Server Computing

31

Port Definitions in WSDL

● Within a service element, you specify the different“ports” on which this service is accessible

● A port specifies the service URL

● Each port has a unique name and a binding attribute

● When using SOAP, the port element contains a<soap:address/> element with the service address

URL

Page 32: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 32/44

Middleware: Client-Server Computing

32

Example: WSDL Port Definitions

● If the URL is http://www.ws/demos/wsdl/devxpert/weatherservice.asp, the port definition would look

like …

<port name=‘WeatherSoapPort’

binding=‘wsdlns:WeatherSoapBinding’><soap:address location=

‘http://www.ws/demos/wsdl/devxpert/weatherservice.asp’ />

</port>

Page 33: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 33/44

Middleware: Client-Server Computing

33

WSDL Message Element

● To use web services in an RPC model, WSDLdescribes the message structures by using the

<message> element■ Each <message> contains zero or more <part> elements.

■ A <part> corresponds to a parameter or a return value in the

RPC call

Page 34: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 34/44

Middleware: Client-Server Computing

34

Example: Messages Elements

● The GetTemperature method would include one inputmessage and one output message

<message name='Weather.GetTemperature'>

<part name='zipcode' type='xsd:string'/>

<part name='celsius' type='xsd:boolean'/></message>

<message name='Weather.GetTemperatureResponse'>

<part name='Result' type='xsd:float'/>

</message>

xsd: float is predefined in http://www.w3.org/2001/XMLSchema

Page 35: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 35/44

Middleware: Client-Server Computing

35

WSDL Operation Element

● The WSDL <operation> element is used to specifywhich message is the input and which message is

the output

● The parameterOrder attribute is optional and may be

used to specify a space-delimited list of part namesto indicate the order of parameters when making the

RPC call

● <input> and <output> elements are specified within

an <operation> element■ Each refers to the corresponding message by its fully

qualified name

Page 36: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 36/44

Middleware: Client-Server Computing

36

Example: Operation Element

● Example: wsdlns:Weather.GetTemperature

<portType name='WeatherSoapPort'>

<operation name='GetTemperature'

parameterOrder='zipcode celsius'>

<input message='wsdlns:Weather.GetTemperature' />

<output message='wsdlns:Weather.GetTemperatureResponse' />

</operation>

<!-- other operations would go here -->

</portType>

Page 37: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 37/44

Middleware: Client-Server Computing

37

WSDL Binding Element (1)

● The WSDL <binding> element is used to bind a <port>

● Inside the <binding>, element the <soap:binding>

extension element can specify the transport protocol

and style of the request

■ SOAP can be used over HTTP, SMTP, or, possibly, any other transport

■ RPC and document are the two styles

<binding name='WeatherSoapBinding'

type='wsdlns:WeatherSoapPort' >

</binding>

Page 38: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 38/44

Middleware: Client-Server Computing

38

WSDL Binding Element (2)

● For each operation that this service exposes, a valueof the SOAP Action is specified in the

<soap:operation> element■ The client must put the SOAP Action value in the HTTP

header when it invokes the service

Page 39: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 39/44

Middleware: Client-Server Computing

39

Example: Binding Element

<binding name='WeatherSoapBinding'

type='wsdlns:WeatherSoapPort' >

<soap:binding style='rpc'

transport='http://schemas.xmlsoap.org/soap/http' />

<operation name='GetTemperature' >

<soap:operation

soapAction='http://tempuri.org/action/

Weather.GetTemperature' />

</operation>

</binding>

Page 40: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 40/44

Middleware: Client-Server Computing

40

WSDL Example I (1)

<binding name='WeatherSoapBinding' type='wsdlns:WeatherSoapPort' ><soap:binding style='rpc'transport='http://schemas.xmlsoap.org/soap/http' />

<operation name='GetTemperature' >

<soap:operation

soapAction='http://tempuri.org/action/Weather.GetTemperature' />

<input>

<soap:body use='encoded' namespace='http://tempuri.org/message/'encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />

</input>

<output>

<soap:body use='encoded' namespace='http://tempuri.org/message/'

encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />

</output>

</operation></binding>

Page 41: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 41/44

Middleware: Client-Server Computing

41

WSDL Example I (2)

● The <operation> element can…■ Include <input> and an <output> element

■ Use a <soap:body> element within each to specify how the

data is encoded

● The URI http://schemas.xmlsoap.org/soap/encoding/

indicates the SOAP encoding style as described in

the SOAP 1.1 specification

Page 42: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 42/44

Middleware: Client-Server Computing

42

WSDL Example II (1)

● WSDL of XMethods, a delayed stock quote XML webservice

Page 43: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 43/44

Middleware: Client-Server Computing

43

WSDL Example II (2)

  <service name="net.xmethods.services.stockquote.StockQuoteService">

<documentation>net.xmethods.services.stockquote.StockQuote webservice</documentation>

<port name="net.xmethods.services.stockquote.StockQuotePort"binding="tns:net.xmethods.services.stockquote.StockQuoteBinding">

<soap:address location="http://66.28.98.121:9090/soap" />

</port>

</service>

<message name="getQuoteResponse1"><part name="Result" type="xsd:float" />

</message>

<message name="getQuoteRequest1">

<part name="symbol" type="xsd:string" />

</message>

<portType name="net.xmethods.services.stockquote.StockQuotePortType"><operation name="getQuote" parameterOrder="symbol">

<input message="tns:getQuoteRequest1" />

<output message="tns:getQuoteResponse1" />

</operation>

</portType>

Page 44: Lecture 04 Client Server

8/8/2019 Lecture 04 Client Server

http://slidepdf.com/reader/full/lecture-04-client-server 44/44

Middleware: Client-Server Computing

Summary

Examined client-server computational model,including models for client-server middleware■ Client-server 

■ Client-agent-server 

■ Client-intercept-server 

● Discussed web services

● Examined web services based on XML

UDDI

WSDLSOAP

XML

HTTP FTP SMTP