Presentation is loading. Please wait.

Presentation is loading. Please wait.

Molde University College INF 245 Fall 2007 OBø 1 INF245 Mobile Applications Networking H 2007 Ola Bø.

Similar presentations


Presentation on theme: "Molde University College INF 245 Fall 2007 OBø 1 INF245 Mobile Applications Networking H 2007 Ola Bø."— Presentation transcript:

1 Molde University College INF 245 Fall 2007 OBø 1 INF245 Mobile Applications Networking H 2007 Ola Bø

2 Molde University College INF 245 Fall 2007 OBø 2 Introduction Connection to the wired internet is gaining interest Access to mobile content Augments computing and storage capacities Local applications are less attractive Pan networking may also be interesting What for? Viruses?

3 Molde University College INF 245 Fall 2007 OBø 3 Challenges Intermittent connections Low bitrate Inpredictable bitrate Considerable latency Price Need for offline operation Limited support for protocols Finding device TCPIP No fixed TCP/IP? Now way to ask for own IP address using J2ME Communications uses battery A range of WWAN data bearer technologies WAP data calls GPRS EDGE 3G WLAN is also a bearer BT may also be a bearer Bearer independence a good idea

4 Molde University College INF 245 Fall 2007 OBø 4 Architectural choices (source Tommi Mikkonen 2007) Infrastructure network WAP HTTP Server/device work distribution? Registering the device? Peer to peer network BT Self organizing, decentralized and dynamic Support for standard services part of device preinstalled service Custom services offered by device may be developed

5 Molde University College INF 245 Fall 2007 OBø 5 Architectural choices Push vs pull Pull is initiated by the device To know that a message from the network is waiting you have to poll – send periodic messages asking if new message to fetch – consumes battery and bandwith - money Traditional solution on the internet Push is initiated by the network Traditional solution in telecoms

6 Molde University College INF 245 Fall 2007 OBø 6 Statefull and stateless systems (source Tommi Mikkonen 2007) Stateful systems remember past operations and internal state – supports a session – a series of related operations More complex HTTP statefullness can be implemented using cookies or hidden fields With.net and jsp/servlet technology statefullness is easily implemented using a session construct Stateless systems generates output based on input not dependent on previous communications HTTP is stateless

7 Molde University College INF 245 Fall 2007 OBø 7 MIDP 1.0 Communication Device must implement a HTTP 1.1 client interface Transport is not necessarily over TCP/IP Other protocols may be supported in MIDP 1.0 The use of other protocols is transparent to the programmer

8 Molde University College INF 245 Fall 2007 OBø 8 Networking using GCF Need a more compact solution, than the standard libraries GCF: General Connection Framework is the answer In GCF all protocols can be specified using an URL-approach: Connector.open(" :// : ") But no network protocol is mandatory in CLDC What protocol can actually be used depend on the device and the profile Examples Connector.open("http://www.sis.pitt.edu/mwap/test.html") Connector.open("file://pictures/picture12.jpg") Connector.open("comm://9600:18N")

9 Molde University College INF 245 Fall 2007 OBø 9 Connection is made by calling a static method in javax.microediton.io.Connector Parameter is a Connection String Example: http://gjedde.himolde.no/karpefisk.png : Return value is an implementation of an interface The Generic Connection Framework

10 Molde University College INF 245 Fall 2007 OBø 10 javax.microedition.io.Connector

11 Molde University College INF 245 Fall 2007 OBø 11 HTTP-Connection HTTP 1.1 only protocol with mandatory support in MIDP 1.0 – why? Less problems with firewalls blocking protocol Supported by web-servers HTTP normally used between server and web- browser to transport HTML and HTML form-data But HTTP is really a protocol for file transfer To leverage existing support in web-servers, emulating the server-browser exchange may be a good idea Only a subset of HTTP 1.1 supported GET, POST, HEAD In MIDP 2.0 HTTPS also mandatory

12 Molde University College INF 245 Fall 2007 OBø 12 HTTP-Review – HTTP is a request- response protocol – Phases ● Setup: Request header and body information is assembled ● Connected: Request is sent and response possibly received ● Response header and body information may be read ● Closed

13 Molde University College INF 245 Fall 2007 OBø 13 HTTP Parameters and methods Clients can send parameters to servers Parameters are name=value f. example: code=in932&name=mobile+wireless+apps Parameters are coded space is converted to + a-z, A-Z, 0-9,.-*_ is unchanged all other characters is converted into %xy, where xy is hexadecimal Method can be GET -fetch a given document, parameters added to URL POST -fetch a given document, parameters sent in message body HEAD - like GET but only header of response is returned Demo of HTML-form

14 Molde University College INF 245 Fall 2007 OBø 14 Making a Connection with HTTP-Get 1. Use Connector Open with the URL 2. Use the returned HTTPConnection as an InputConnection to read the data Parameters must be encoded and added to the URL http://gjedde.himolde.no/example?name=Peter+S mart&address=2323+Idea+drive http://gjedde.himolde.no/example?name=Peter+S mart&address=2323+Idea+drive http://gjedde.himolde.no/example?name=Daniel+ Düsentrieb&address=2323+Idea+drive http://gjedde.himolde.no/example?name=Daniel+ Düsentrieb&address=2323+Idea+drive

15 Molde University College INF 245 Fall 2007 OBø 15 Sample code Purpose: fetch and display a text from a server Midlet with life-cycle methods Instantiates and displays a form Form HTTP-communication Commands to Connect and Exit Items Gauge and StringItem Thread for communication

16 Molde University College INF 245 Fall 2007 OBø 16

17 Molde University College INF 245 Fall 2007 OBø 17

18 Molde University College INF 245 Fall 2007 OBø 18

19 Molde University College INF 245 Fall 2007 OBø 19 More advanced techniques Passing parameters See Li and Knudsen pp149-152 Implementing statefulness using Cookies See Li and Knudsen pp 152-157 Registering for PUSH notifications See Li and Knudsen pp 160-163

20 Molde University College INF 245 Fall 2007 OBø 20 JSR172 MIDP Java and Web Services (source Tommi Mikkonen 2007) The basis of many networking applications on the Internet Client/Server Infrastructure based networking technology Service is described using Web Service Description Language (WSDL) and accessed using Simple Object Access Protocol (SOAP) over HTTP. SOAP Request and response are encoded in XML Stub, Service Provider Interface and Local Client are implemented from the web service description using tools 1.ordinary method call 2.Stub calls via platform independent interface 3.SPI calls local Client 4.Local client calls remote service using SOAP

21 Molde University College INF 245 Fall 2007 OBø 21 JSR82 Java API for Bluetooth Wireless Technology (JABWT) Two different APIs Java API for Bluetooth Access to PAN Networking Discovering other bluetooth devices Discovering the services other devices has to offer Using and offering bluetooth services Java API for OBEX (Object Exchange) Can be implemented using IR, Bluetooth, IP,.. Can be used to exchange contact information vCard, scheduling vCalendar,... Protocol similar to HTTP Source Li and Knudsen (2005) ch 12.

22 Molde University College INF 245 Fall 2007 OBø 22 Midlet that can discover and find the services of bt-devices

23 Molde University College INF 245 Fall 2007 OBø 23 The code for the whole MIDlet is available on kursinfo in the code subfolder

24 Molde University College INF 245 Fall 2007 OBø 24 References Mikkonen, Tommi (2007) Programming Mobile Devices – An Introduction for Practitioners, Wiley ISBN 978-0-470-05738-4 JSR 118 Expert Group. (2006) Mobile Information Device Profile for Java™ 2 Micro Edition Version 2.1 Li and Knudsen (2005) Beginning J2ME From Novice to Professional


Download ppt "Molde University College INF 245 Fall 2007 OBø 1 INF245 Mobile Applications Networking H 2007 Ola Bø."

Similar presentations


Ads by Google