Client-Server Computational Model Middleware: Lecture Objectives
Client-Server Computational Model Middleware: Lecture Objectives
Lecture 4
Client-Server Computational
Model Middleware
Ing-Ray Chen
Copyright Reserved
Lecture Objectives
• Differentiate and exemplify client-server, client-
agent-server, and client-intercept-server model
middleware
• Understand functionality provided by middleware for
client-side, agent-side, and server-side software
development
• Understand how client-server computational model
middleware is able to deal with wireless device
heterogeneity and scalability issues
• Characterize design requirements of example client-
server applications (e.g., wireless and mobile web
access) and rationalize the choice of middleware
and design for application development
1
Sources
• D. Ferguson, Mobile .NET, a! APress, 2002.
• http://www.wapforum.org/
• http://www.wapforum.com/
• http://www.nttdocomo.com/ - for i-mode.
• http://www.pocketsoap.com/ - for PocketSOAP
• http://www.ksoap.org/ - for kSOAP
• http://msdn.microsoft.com/vstudio/device/mobilecon
trols/default.asp - for Microsoft’s Mobile Internet
Toolkit (MIT)
• http://www.learnxmlws.com/tutors/wsdl/wsdl.aspx -
for WSDL
Agenda
• Client-Server Computational Models
• XML-based technology for facilitating wireless web
access from smart devices
! Small Object Access Protocol (SOAP)
! Web Service Description Language (WSDL)
! Example 1: Embedded Visual Tool + PocketSOAP for iPAQs
! Example 2: J2ME + kSOAP for J2ME-enabled devices
• Microsoft Mobile Internet Toolkit (MIT)
! Introduction to server-side development environment
! Learn how to design server-side .NET software to be
accessed from heterogeneous mobile devices such as
Pocket PCs, i-mode, WAP-enabled devices, etc.
2
Client-Server Models for Wireless Mobile
Computing (1)
• Mobile client-server
! Message passing with queueing
! Remote procedure call
" Synchronous: inadequate since the client is blocked in case of
disconnection
" Asynchronous: client requests can be 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 RPC is forwarded to the server
! Optimization involves changes to both the client and server
Application Application
Wireless Server
Client link
Fixed
Mobile network
host
ECE/CS 4984, Spring 2003 5 Client-Server Computational Model Middleware
Fixed network
Application Application
Client
Wireless Agent Server
link
Mobile
host
3
Client-Server Models for Wireless Mobile
Computing (3)
• Client-Intercept-server
! Inter-agent optimization protocols can be performed between the
client-side and server-side agents to minimize communication cost
via caching, differencing, header reduction, one-HTTP connection per
session, etc.
! Caching/prefetching at the client agent to allow disconnected
operations, e.g., via ADO .NET/SQL server CE
! Example: IBM Web Express: Web Browser (client) - HTTP - Client side
agent - TCP/IP connection <-> Server side agent - Web server
XML
• XML (Extensible Markup Language) – A platform-neural data
standard for describing, storing and transporting data across the
web
• XML is a core technology for web services
! Use XML as a basis for separately developed web services to interact
with each other
! Use XML to facilitate component developments
" Packaging application functionality as smaller, easily connected
web services
" Composing an application using “web services” components
• XML and .NET: .NET is a Microsoft technology to develop XML
web services on many platforms
! .NET ASP (Active Server Page) can be used to develop web services
! .NET CF can be used to develop web services on small devices
! MIT (Microsoft Internet Toolkit) can be used to develop server-side
proxy to deal with heterogeneous mobile devices
4
XML and Wireless Web Access
• The synergy between XML and wireless can be
considered from two perspectives:
! XML has emerged as the data representation technology
facilitating content delivery (via XML transformation) to a
wide variety of mobile devices and platforms
! XML is a meta-language (a set of rules to define domain-
specific data definition languages), thus driving the success
of XML-based wireless web access initiatives including:
" WML, an XML-compliant language used by WAP 1.0
" XHTML, an XML-compliant language adopted by WAP 1.2
and future i-mode
" WSDL (Web Service Description Language), an XML-
compliant language normally used in a WSDL document
to describe a web service's interface, i.e., providing
clients with information on how to invoke a web service.
XML Transformation
• XML separates the data
from a fixed description
of how the data should be cHTML
displayed
• XSL (Extensible Style-
Sheet Language)
describes how to display
content XML XSLT XHTML
! XSLT is an XML-based
transformation
technology to
programmatically
transform XML data into WML
other mobile
device/platform specific
formats such as cHTML,
XHTML and WML
5
Using XSLT to target XML to different
Wireless Mobile Devices
WML
XSLT for WAP
<?xml version=‘1.0’?>
<response id=“Result”>
<class
ECE/CS4984 cHTML
XSLT
XSLT for i-mode
</class> Engine
<price>
Invaluable
</price> PDA-
specific
</response> XSLT for PDA (XHTML)
6
Accessing Web Services
From http://www.learnxmlws.com/tutors/wsdl/wsdl.aspx
7
WSDL for Defining Web Services (2)
• Within a service element, you specify the different “ports” on
which this service is accessible
• A port specifies the service URL, For example, if the URL is
http://www.ws/demos/wsdl/devxpert/weatherservice.asp, the
port definition would look like this:
<port name='WeatherSoapPort'
binding='wsdlns:WeatherSoapBinding' >
<soap:address location=
'http://www.ws/demos/wsdl/devxpert/weatherservice.asp' />
</port>
<message name='Weather.GetTemperatureResponse'>
<part name='Result' type='xsd:float'/>
</message>
xsd: float is predefined in http://www.w3.org/2001/XMLSchema
ECE/CS 4984, Spring 2003 16 Client-Server Computational Model Middleware
8
WSDL for Defining Web Services (4)
• The WSDL <operation> element is used to specify which
message is the input and which message is the output, e.g.,
<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>
9
WSDL for Defining Web Services (6)
<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>
• Within the <operation> you add an <input> and an <output> element and 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.
ECE/CS 4984, Spring 2003 19 Client-Server Computational Model Middleware
10
eVC++ Client to Access the Stock Quote
Web Service using PocketSOAP
• Using PocketSOAP, an eVC++ program can access the stock
quote web service from your iPAQ. We first get user input from
an edit box. Then we invoke the RPC with the stock symbol
entered by a SOAP message to the web server. After receiving a
SOAP response returned from the server, we display the stock
price quoted in the list box.
void CLab4Dlg::OnGo()
{
// get the stock symbol entered by the user
symbol->GetWindowText(strSymbol) ;
// create a new SOAP envelop object
CoCreateInstance(__uuidof(CoEnvelope),NULL,
CLSCTX_INPROC, __uuidof(ISOAPEnvelope), (void **)&penv ) ;
// Set method name and put in the unique namespace of the method
penv->put_MethodName ( CComBSTR(OLESTR("getQuote")) ) ;
penv->put_URI ( CComBSTR(OLESTR("urn:xmethods-delayed-quotes")) ) ;
11
J2ME Client to Access the Stock Quote
Web Service using kSOAP
import javax.microedition.midlet.*; import javax.microedition.lcdui.*;
import java.io.*; import javax.microedition.io.*;
import org.ksoap.*; import org.ksoap.transport.*;
public class StockQuote extends MIDlet implements CommandListener {
Form mainForm = new Form ("StockQuotes");
TextField symbolField = new TextField ("Symbol", "IBM", 5, TextField.ANY);
StringItem resultItem = new StringItem ("", ""); /* label followed by content */
Command getCommand = new Command (“Go", Command.SCREEN, 1);
public StockQuote () {
mainForm.append (symbolField);
mainForm.append (resultItem);
mainForm.addCommand (getCommand);
mainForm.setCommandListener (this); }
12
Dealing with Device Heterogeneity using
Microsoft’s Mobile Internet Toolkit (MIT)
• Microsoft Mobile Internet Toolkit contains server-side
technology that enables a server (or server-side agent) to
deliver content to a wide variety of mobile devices
! Only a single web service implementation is required to be
developed at the server side using MIT in Visual Studio .NET to deal
with device heterogeneity
! The GUI application can be built with “drag and drop” and
Application Wizards in Visual Studio .NET
• Depending on the client connecting to the web service, MIT can
alter its page rendering accordingly to device types for which
their associated “device adaptors” exist, including
! Internet Explorer (IE): XML to HTML
! Pocket PC IE: XML to HTML
! Pocket PC client developed based on .NET CF: XML/SOAP
! WAP: XML to WML (WAP 1.0) or XHTML (WAP 2.0)
! i-mode: XML to cHTML
13
Example: Creating a Web Service Proxy
using MIT in Visual Studio .NET (1)
• Here we use MIT to create a
mobile web application that
serves as a “server-side proxy”
located between a web service
and various heterogeneous
mobile devices
• A Mobile Web Form “form1” is
created using drag and drop for
accepting the user input
• The stock symbol entered is sent
to a stock quote web service
• The stock value returned is
displayed in another Mobile Web
Form “form2.”
• For example, if the web reference added is the WSDL of the stock quote
web service provided xmethods.net at the following URL:
http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl
then the following C# class will be created by MIT to refer to the stock
quote web service:
net.xmethods.services.netxmethodsservicesstockquoteStockQuoteService
14
Example: Creating a Web Service Proxy
using MIT in Visual Studio .NET (3)
public class MobileWebForm1 : System.Web.UI.MobileControls.MobilePage
{
protected System.Web.UI.MobileControls.TextBox TextBox1;
protected System.Web.UI.MobileControls.Command Command1;
protected System.Web.UI.MobileControls.Form Form2;
protected System.Web.UI.MobileControls.Label Label1;
protected System.Web.UI.MobileControls.Form Form1;
15
WAP-Device Web Service Access
<?xml version='1.0'?>
<!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.1//EN'
'http://www.wapforum.org/DTD/wml_1.1.xml'>
<wml>
<head>
<meta http-equiv="Cache-Control" content="max-age=0" />
</head>
<card>
<onevent type="onenterforward">
<refresh>
<setvar name="TextBox1" value="" />
</refresh>
</onevent>
<do type="accept" label="Go"><go
href="/StockQuoteProxy/(jx0oiiqq22z1vm450ucv1zfb)/mobilew
ebform1.aspx" method="post">
<postfield name="__EVENTTARGET" value="Command1" />
<postfield name="TextBox1" value="$(TextBox1)" />
</go>
</do>
<p><input name="TextBox1" />
</p></card>
</wml>
ECE/CS 4984, Spring 2003 31 Client-Server Computational Model Middleware
16