aspose file tools*
The moose likes Web Services and the fly likes REST in mobiles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "REST in mobiles" Watch "REST in mobiles" New topic
Author

REST in mobiles

feda alshahwan
Ranch Hand

Joined: Jul 26, 2008
Posts: 170
What is the best framework to use with J2ME to implement RESTful web services in mobiles?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12785
    
    5
I don't see why you need a framework on the client - surely the REST response is unique to your application and needs custom code.

If on the other hand you are talking about the server side, the Jersey toolkit looks good to me and is in the mainstream of Java development.

Bill
feda alshahwan
Ranch Hand

Joined: Jul 26, 2008
Posts: 170
Does J2ME supports Jersey?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12785
    
    5
I sense considerable confusion here.

Jersey is a server-side toolkit for creating RESTful web services. RESTful web services respond to the plain HTTP operations - GET, POST, etc with a response containing anything you care to output.

J2ME is a client side environment - making a URL connection to any web resource - it does not care what server-side tool manages the resource.

Are you trying to build both server and client code or trying to connect to an existing service?

Bill
feda alshahwan
Ranch Hand

Joined: Jul 26, 2008
Posts: 170
I am trying to create server/client on mobile for providing and consuming web services.Thanks.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12785
    
    5
I am trying to create server/client on mobile for providing and consuming web services.


AH that is quite a challenge - taking a quick look at some of the APIs, I see the classes for Sockets normally found in the java.net package are in a javax.microedition.io package.

Whichever open source server code, such a Jersey, you work with will probably have to be rewritten for ME.

Come to think of it, Jersey and all other web service toolkits use lots of other classes not in J2ME. Your best bet will be to start with a bare-bone server and just add the specific functions needed for your service.

A google search for "minimal java web server" found some compact servers.

Bill
feda alshahwan
Ranch Hand

Joined: Jul 26, 2008
Posts: 170
Yes its a challenge and I tried with RESTlet frame work and it is also not supported . If you have any idea help pleaese .thanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12785
    
    5
If this was my problem I would start by trying to get a minimal HTTP server running in the J2ME environment.

From there you need to define which REST methods and response MIME types you want to support. Create examples of requests you want the service to respond to using something like HttpClient on a desktop system.

It will also be a LOT simpler if you do not attempt to do dynamic deployment of new functions while the server is running.

I don't think you will find any of the toolkits useful (except as inspiration) because they are being designed for the full server environment.

Bill
feda alshahwan
Ranch Hand

Joined: Jul 26, 2008
Posts: 170
Thank you. I have created small server on the mobile that is listening to incomming requests but my question is how RESTful web services are implemented and deployed on J2ME . What will be the style of it suppose I want to implement small web service that performd the addition of two integers. with RESTlet it is easy how about J2ME. I am little confused.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12785
    
    5
There is nothing magic about a RESTful web service, it is just a service that responds to HTTP requests by following the REST design philosopy. Many many thousands of words have been expended in trying to explain this philosophy - way too much to summarize here. I have written several articles on the subject which you can get to from my home page. Alternately google for "RESTful design."

Implementation will involve code that looks at an incoming HTTP request - both URL and request headers - and decides which class or method should handle creating the response. Pretty much what standard servlets do but with a more strict design philosophy.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: REST in mobiles