Bruce Scharlau, University of Aberdeen, 2010 Java ME Networking Mobile Computing Some slides from MobEduNet This covers HTTP in detail, and mentions other.

Slides:



Advertisements
Similar presentations
Legal Meetings: Extended Instructions on Movica and Screencast.
Advertisements

4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
May 13th, Lucek Consulting Basic Java Servlet/JSP Web Development David Lucek Lucek Consulting
Bruce Scharlau, University of Aberdeen, 2012 Networking for Mobiles Mobile Computing Some slides from MobEduNet This covers HTTP in detail, and mentions.
Bruce Scharlau, University of Aberdeen, 2012 Data storage options for mobiles Mobile Computing.
Bruce Scharlau, University of Aberdeen, 2010 Android UI, and Networking Mobile Computing Based on android-sdk_2.2 Unless otherwise stated, images are from.
JSP and web applications
MIDP Mobile Information Device Profile Johnny Yau CIS 642 Prof. Insup Lee.
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
Presentation 11: SOAP on small devices. Ingeniørhøjskolen i Århus Slide 2 af 14 Outline Which small devices? What are the limitations and what kind of.
Multimedia Network Communications Subject:T0934 / Multimedia Programming Foundation Session:13 Tahun:2009 Versi:1/0.
Web Server Programming
UNDERSTANDING JAVA APIS FOR MOBILE DEVICES v0.01.
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
CSCI 4550/8556 Computer Networks Comer, Chapter 3: Network Programming and Applications.
1 HyCon Framework Overview Frank Allan Hansen and Bent Guldbjerg Christensen ! Run this presentation in presentation mode to watch animations.
Developing Software for Wireless Devices
Introduction to Remote Method Invocation (RMI)
Cosc 4730 Phone Programming in Java An Introduction.
Networking with Java CSc 335 Object-Oriented Programming and Design Spring 2009.
Quick Tour of the Web Technologies: The BIG picture LECTURE A bird’s eye view of the different web technologies that we shall explore and study.
Struts 2.0 an Overview ( )
UNIT-V The MVC architecture and Struts Framework.
Web server and web browser It’s a take and give policy in between client and server through HTTP(Hyper Text Transport Protocol) Server takes a request.
An Introduction to the Java ME Project Jens A Andersson.
INTRODUCTION TO WEB DATABASE PROGRAMMING
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
SSC2: Web Services. Web Services Web Services offer interoperability using the web Web Services provide information on the operations they can perform.
Java Omar Rana University of South Asia. Course Overview JAVA  C/C++ and JAVA Comparison  OOP in JAVA  Exception Handling  Streams  Graphics User.
Presentation: SOAP in a distributed object framework, Application Servers & AXIS SOAP.
Small Devices on DBGlobe System George Samaras Chara Skouteli.
An program As a simple example of socket programming we can implement a program that sends to a remote site As a simple example of socket.
Framework and application bytecode size CLDC MIDP kXML parser Utility classes Graphics Logic (MIDlet) Application Data (XML file)
COMP 321 Week 7. Overview HTML and HTTP Basics Dynamic Web Content ServletsMVC Tomcat in Eclipse Demonstration Lab 7-1 Introduction.
HOW WEB SERVER WORKS? By- PUSHPENDU MONDAL RAJAT CHAUHAN RAHUL YADAV RANJIT MEENA RAHUL TYAGI.
Lecture 15 Introduction to Web Services Web Service Applications.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems.
1. I NTRODUCTION TO N ETWORKS Network programming is surprisingly easy in Java ◦ Most of the classes relevant to network programming are in the java.net.
Chapter 6 Server-side Programming: Java Servlets
Introducing ASP.NET 2.0. Internet Technologies WWW Architecture Web Server Client Server Request Response Network HTTP TCP/IP PC/Mac/Unix + Browser (IE,
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Kemal Baykal Rasim Ismayilov
ASP.NET (Active Server Page) SNU OOPSLA Lab. October 2005.
1 Introduction to Servlets. Topics Web Applications and the Java Server. HTTP protocol. Servlets 2.
JS (Java Servlets). Internet evolution [1] The internet Internet started of as a static content dispersal and delivery mechanism, where files residing.
What is a Servlet? Java Program that runs in a Java web server and conforms to the servlet api. A program that uses class library that decodes and encodes.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
1 G52IWS: Example Web-services Chris Greenhalgh. 2 Contents Software requirements AXIS web service run-time components Getting started with Jetty & AXIS.
Java Servlets and Java Server Pages
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
The Java Platform Micro Edition Java ME
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
Java N Amanquah.
Lab 3: More Phone-Based Techniques
WEB SERVICES From Chapter 19 of Distributed Systems Concepts and Design,4th Edition, By G. Coulouris, J. Dollimore and T. Kindberg Published by Addison.
Outline SOAP and Web Services in relation to Distributed Objects
Course Outcomes of Advanced Java Programming AJP (17625, C603)
Web Software Model CS 4640 Programming Languages for Web Applications
Outline SOAP and Web Services in relation to Distributed Objects
Introduction to J2EE Architecture
WEB API.
WEB SERVICES From Chapter 19, Distributed Systems
Directories and DDs 25-Apr-19.
Directories and DDs 21-Jul-19.
Presentation transcript:

Bruce Scharlau, University of Aberdeen, 2010 Java ME Networking Mobile Computing Some slides from MobEduNet This covers HTTP in detail, and mentions other means. Bluetooth will be covered later.

Bruce Scharlau, University of Aberdeen, 2010 Getting the application onto the device with OTA OTA is Over the Air provisioning and lets users acquire the jad/jar as required via their browser

Bruce Scharlau, University of Aberdeen, 2010 OTA using Java

Bruce Scharlau, University of Aberdeen, 2010 OTA can be done with Antenna The following steps are necessary to run the OTA servlet: Install a servlet-capable Web server Add a new Web application under " /webapps". Copy the "web.xml" file from the "etc" directory of the Antenna source distribution to "WEB-INF" and adjust. Copy the "antenna-bin.jar" binary distribution file to "WEB-INF/lib". You should have a working configuration now. If the servlet URL is " the HTML and WML pages are available as " and " respectively. Test deployment by running the "deploy" sample (modify "build.xml" first). To create your own layout for the pages, copy the two files from the "res" directory of the Antenna source distribution (or from CVS) to "WEB-INF" and modify them. There's documentation inside the "index.html" file that tells you how to do this.

Bruce Scharlau, University of Aberdeen, 2010 Servlet templates are provided OTAServer (servlet) available under C:\Java\antenna-src-1.2.0\src\de\pleumann\antenna\http OTAServer (servlet) available under C:\Java\antenna-src-1.2.0\src\de\pleumann\antenna\http

Bruce Scharlau, University of Aberdeen, 2010 Java uses Internet for direct connections Network operator

Bruce Scharlau, University of Aberdeen, 2010 Java end to end is possible From pdfs at:

Bruce Scharlau, University of Aberdeen, 2010 CLDC - GCF Connected Limited Device Configuration offers Generic Connection Framework –Takes in URI as String and returns a connection object –All use pattern of: :// ;

Bruce Scharlau, University of Aberdeen, 2010 MIDP 2.0 Additions moved beyond required HTTP Added other interfaces and classes –HTTPSConnection for secure http connections –PushListener for use with PushRegistry and listens for inbound connections –SecureConnection to establish SSL or TLS connections –SecurityInfo interface provides methods to access secure networks –ServerSocketConnection defines this type of connection –UDPDatagramConnection

Bruce Scharlau, University of Aberdeen, 2010 extra APIs can enhance applications Just remember that they are optional, so may not be available

Bruce Scharlau, University of Aberdeen, 2010 Network URIs for HttpConnection socket://time-a.nist.gov:13 for StreamConnection serversocket://:4444 for StreamConnectionNotifier comm:0;baudrate=2400 for CommConnection datagram:// for DatagramConnection file://address.dat for FileConnection bluetooth://psm=1001 for StreamConnection

Bruce Scharlau, University of Aberdeen, 2010 Generic Connection Framework

Bruce Scharlau, University of Aberdeen, 2010 Variety of Interfaces used for connections Connection (basic, generic connection) –close method –open method defined in Connector-class InputConnection (capabilities needed in input stream connection) –openDataInputStream, openInputStream OutputConnection (capabilities needed in output stream connection) –openDataOutputStream, openOutputStream StreamConnection (combines input and output) –All methods inherited ContentConnection (defines streamconnection over which content is passed) –getEncoding, getType CommConnection (defines a logical serial port connection) SocketConnection (defines socekt stream connection) Connection InputConnection OutputConnection DatagramConnection StreamConnectionNotifier StreamConnection ContentConnection HttpConnection HttpsConnection CommConnection SocketConnection SecureConnection

Bruce Scharlau, University of Aberdeen, 2010 Basic Architecture is simple Internet MIDP Device Web Server User requests information from an Application (e.g. MyServlet) Web server passes output from MyServlet back to the MIDlet Web Server launches MyServlet program and sends it parameters the MIDlet requested Web Server retrieves output from the MyServlet

Bruce Scharlau, University of Aberdeen, 2010 What is needed ? MIDlet & MIDP Device Servlet & Web Server Connection between MIDP Device & Web Server Common Protocol between MIDlet and Servlet

Bruce Scharlau, University of Aberdeen, 2010 Opening a Connection is easy Connection throws IOException so can report errors back to application try { Connection connection = Connector.open( } catch (IOException ioe) { //report error } Connection also has close() method

MIDP 3 is MSA (Mobile Service Architecture) Aims to provide wider functionality for mobiles Should work with CDC and CLDC devices Should allow RFID and NFC object communication Should enable XML parsing Bruce Scharlau, University of Aberdeen, 2010

On Beyond Basics web services via SOAP and REST RMI Location API These require extra libraries Need to check that they are present on device

Bruce Scharlau, University of Aberdeen, 2010 Use JSR 179 and JSR 280 to parse RESTful XML Parse the XML to object on handset Check links on course web site

Bruce Scharlau, University of Aberdeen, 2010 XML parsing requires several files Go together Midlet plus parser handler class, and object class

Parsing errors not always obvious Bruce Scharlau, University of Aberdeen, 2010 midlet parse midlet handler org.xml.sax.SAXParseException: - com.sun.ukit.xml.SAX$Parser.panic(), bci=6 - com.sun.ukit.xml.Parser.setinp(), bci=237 - com.sun.ukit.xml.SAX$Parser.parse(), bci=36 - com.sun.ukit.xml.SAX$ParserImp.parse(), bci=56 - com.auction.j2me.MyParsingMIDlet.loadXML(), bci=33 - com.auction.j2me.MyParsingMIDlet$1.run(), bci=11 midlet alert Need to catch errors, but sometimes only the emulator that causes problems

Bruce Scharlau, University of Aberdeen, 2010 Need to use threads for multi-tasking in application Start a connection in a new thread so the application doesnt hang while waiting for a response

Bruce Scharlau, University of Aberdeen, 2010 Wrap thread for connection in try/catch public void commandAction(Command c, Displayable arg1) { if (c == mExitCommand) { notifyDestroyed(); } else if (c == mLoginCommand) { login(); } else if (c == mBackCommand) { mainMenu(); } else if (c == mHelloCommand) { Thread thread = new Thread() { public void run() { try { invokeServlet(); } catch (IOException e) { e.printStackTrace(); } } }; thread.start(); }

Bruce Scharlau, University of Aberdeen, 2010 Dukes Auction has two versions AuctionServletAuctionByteServlet Use Strings Use bytes to determine options

Bruce Scharlau, University of Aberdeen, 2010 Bytes are easier to organise Pass byte as option

Bruce Scharlau, University of Aberdeen, 2010 Methods are similar Get parameter (optional), create message, write reply

Bruce Scharlau, University of Aberdeen, 2010 MIDlet works with bytes anyways Same as hello() on next slide

Bruce Scharlau, University of Aberdeen, 2010 Binary response to Midlet Same as invokeServlet()

Bruce Scharlau, University of Aberdeen, 2010 Round trip with octet-stream from client to servlet From pdfs at:

Bruce Scharlau, University of Aberdeen, 2010 Binary code makes it a pure Java solution Tightly coupled to the service. Need to use web services to interoperate with other systems. A change in one will require change in other

Bruce Scharlau, University of Aberdeen, 2010 There are trade-offs between binary and XML From pdfs at:

Bruce Scharlau, University of Aberdeen, 2010 Need to consider state in application As with web apps, need to determine if, and how you will deal with state

Bruce Scharlau, University of Aberdeen, 2010 Sessions can maintain state the same as in regular web applications Use either cookies or, preferably, URL rewriting However, network operators can mangle the headers though, so dont rely upon them Some operators use transcoding, which messes up your application See: for detailshttp://wurfl.sourceforge.net/manifesto/index.htm

Bruce Scharlau, University of Aberdeen, 2010 Object reuse and development Same code in servlet and MIDlet Repeated code in MIDlet Need process such as Ant to cope with this, or use other solution

Bruce Scharlau, University of Aberdeen, 2010 Use same OOD principles for MIDlets as for other code Refactor out methods classes Apply design patterns as appropriate Remember that its mobile, so constrain for reduced memory

Bruce Scharlau, University of Aberdeen, 2010 Abstract out repeated code into methods AuctionMIDlet repeats lots of code so that its clear whats happening. These could be removed to a method, or separate class – connection, try/catch, etc There is also the issue of the shared code between the servlet and MIDlet

Bruce Scharlau, University of Aberdeen, 2010 Extend Ant to cover building of web and midlet suite Use Ant and Antenna to build whole application Build MIDlet Build War Deploy MIDlet Deploy War Integrate and copy code as required

Bruce Scharlau, University of Aberdeen, 2010 Summary Can use variety of means to connect Java ME devices to a network via GCF All MIDP 2.0 devices support at least HTTP – need to check for capabilities Sometimes need to share code across platforms (server and Java ME client) to ease programming