jQuery in Action, 2nd edition*
The moose likes Web Services and the fly likes Mobile Web services Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Mobile Web services" Watch "Mobile Web services" New topic
Author

Mobile Web services

feda alshahwan
Ranch Hand

Joined: Jul 26, 2008
Posts: 170
What is the best platform,web service technology and application required to implement web services that are for mobiles ?
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Have a look at Working with Webservices in J2ME

So SOAP or even XML-based web services might not be the best idea for performance and resource challenged mobile platforms.
feda alshahwan
Ranch Hand

Joined: Jul 26, 2008
Posts: 170
What is better for implementing mobile web services : SOAP or REST
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1479
    
    6

So far as my knowledge goes all mobile devices dont have the support of JSR 172(Web service api), so it might be better to go ahead with simple http connections.


Swastik
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
feda alshahwan wrote:What is better for implementing mobile web services : SOAP or REST

In most cases SOAP is not required because its flexibity, extensibility (and therefore associated complexity) isn't required for the mobile to service interaction. And in any case the web service can always act a proxy for the mobile client, taking the burden of the necessary conversions.

RESTful web services can be accessed with simple HTTP interactions and aren't restricted to XML content either. So when appropriate, your mobile client can set the HTTP-request Accept header to text/plain and receive, for example, a comma separated list of values, provided of course that the resource supports the text/plain media type with that representation format.

The point is that a resource can be implemented to support any number of IANA MIME Media Types (simultaneously).

Java-based RESTful web service frameworks: Jersey (JAX-RS (JSR-311)), Restlet.

It seems however that mobile clients prefer web servers that are capable of flushing the HTTP reponse headers separately from the HTTP response body. That gives the client environment a chance to properly prepare for the receipt of potentially large amounts of data.
feda alshahwan
Ranch Hand

Joined: Jul 26, 2008
Posts: 170
What do you mean by Mime Iana? I want web services both for mobile client and mobile server. The advantage of Soap over rest that it allows running over other protocols not only HTTP? Do you have any other opinion?
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
feda alshahwan wrote:What do you mean by Mime Iana?

Click on the link.

SOAP is restricted to XML. So non-XML content has to be base64 encoded or you have to employ one of the attachment technologies for SOAP (no attachment technology enjoys universal support). You can put anything in the HTTP body as long as you identify it with the correct IANA MIME Media Type in the Content-Type HTTP header.

The advantage of Soap over rest that it allows running over other protocols not only HTTP?

That is correct. However in the majority of cases that feature will never be used. So all the development effort and runtime overhead that goes into dealing with the added SOAP layer is completely wasted for features that are never harnessed.

If you have a legitimate reason right now or in the near future to require moving SOAP messages over a protocol other than HTTP, development tools that support binding to protocols other than HTTP and a mobile platform that has plenty of power to spare to absorb the processing overhead of XML and SOAP - then go ahead. However in many cases it still makes more sense to keep the communication between the mobile and (stationary) server "light" - if necessary the stationary server can add the necessary SOAP layer if the message needs to move on.
feda alshahwan
Ranch Hand

Joined: Jul 26, 2008
Posts: 170
I read about rest and rpc differences and I think that using REST for consuming and producing web services by mobiles is better. But since I know nothing about mobile applications and REST. So How can I start doing it please?
 
jQuery in Action, 2nd edition
 
subject: Mobile Web services