Web applications with web-service API access
Posted: Sun Apr 19, 2009 10:02 pm
I'm building an iPhone client for an existing web application and trying to decide how best to go about the client-server communication. Right now the application is tightly bound to the assumption it is being accessed via a web browser using HTML/Forms.
I don't really have any experience with REST, XMLRPC or SOAP, though I have used SOAP (on the client side) for some third party web services.
Does anyone have any pointers on what considerations I might need to make, and which of REST, SOAP or XMLPC make the most sense for something like an iPhone client (native) to interface with a remote service?
My understanding of REST is that the client has to have quite a solid understanding of the data it's working with (it's doesn't deal with encapsulation) and the server's handling of the requests from the client isn't particularly clever (it just does as it's told). I'm thinking that this makes REST a less ideal candidate, but somebody correct me if I'm wrong. REST is more about transferring raw data between the server and the client, than it is about making remote method calls on the model.
As for SOAP, while I'm sure I can translate more or less any object-oriented model into a service accessed over SOAP, it's hella tedious and bloated.
XMLRPC... I'm not familiar with in the slightest.
Basically, I want my iPhone client to be able to send requests to the server and receive responses that it is able to translate into client-side model changes, but I don't want the client to have an intimate knowledge of how to model is implemented on the server.
The other thing I'm thinking about is how to centralise logic which changes the model (on the server). Right now controller actions handle form submissions. If I had a web-service acrhitecture available, it would be great to delegate such logic to the corresponding action on the web service. I'm hoping that this sort of indirection could promote a thin controller design as a side-effect.
Anybody got experience with exposing a web application's features over some sort of service API as well as via a GUI presented by a web browser?
Say for example our web application is a forum. In our web application we might have a PostController which handles creating posts:
These actions expect form data and return HTML. I need an equivalent set of actions that are accessed not via a web browser, but by sending XML/JSON to the server and receiving XML/JSON as a response. But I don't want to duplicate too much functionality. My thinking right now is that in the createPost() action that deals with form input, it takes the request data, turns it into XML/JSON and invokes the call on the web service (ideally without the HTTP overhead), interprets and XML/JSON response from the service and presents HTML to the user.
Am I thinking the right way about this? Are there any abstraction libraries available that will help me with this?
I don't really have any experience with REST, XMLRPC or SOAP, though I have used SOAP (on the client side) for some third party web services.
Does anyone have any pointers on what considerations I might need to make, and which of REST, SOAP or XMLPC make the most sense for something like an iPhone client (native) to interface with a remote service?
My understanding of REST is that the client has to have quite a solid understanding of the data it's working with (it's doesn't deal with encapsulation) and the server's handling of the requests from the client isn't particularly clever (it just does as it's told). I'm thinking that this makes REST a less ideal candidate, but somebody correct me if I'm wrong. REST is more about transferring raw data between the server and the client, than it is about making remote method calls on the model.
As for SOAP, while I'm sure I can translate more or less any object-oriented model into a service accessed over SOAP, it's hella tedious and bloated.
XMLRPC... I'm not familiar with in the slightest.
Basically, I want my iPhone client to be able to send requests to the server and receive responses that it is able to translate into client-side model changes, but I don't want the client to have an intimate knowledge of how to model is implemented on the server.
The other thing I'm thinking about is how to centralise logic which changes the model (on the server). Right now controller actions handle form submissions. If I had a web-service acrhitecture available, it would be great to delegate such logic to the corresponding action on the web service. I'm hoping that this sort of indirection could promote a thin controller design as a side-effect.
Anybody got experience with exposing a web application's features over some sort of service API as well as via a GUI presented by a web browser?
Say for example our web application is a forum. In our web application we might have a PostController which handles creating posts:
Code: Select all
class PostController ... {
function createPost() {
}
function deletePost() {
}
function movePost() {
}
}Am I thinking the right way about this? Are there any abstraction libraries available that will help me with this?