Rest or Soap for a calculation?

Ryan.LangtonRyan.Langton USMember

So the mobile app will have a page where a user enters in about 10 options for criteria. It then must perform some calculations based on a matrix of values and return results. The matrix is controlled by the application owners so the data for the calculations are stored server side. I was looking at using all REST services to access data because it is the most lightweight and seems to work well for mobile (easy to consume). However, this seems to violate the principles of REST. Should I create the server side component as a SOAP service? Or I suppose another option would be to download the matrix to the phone via a REST service, then do all the calculations within the app. This would have the disadvantage of not being quite as easily shared if it needed to be in the future, with say another website.

Posts

  • ChristiaanJPvanWykChristiaanJPvanWyk ZABeta, University, Developer Group Leader ✭✭

    Hi,

    I doubt you will be violating the principles of REST any more than what the potential future pains you are potential introducing with SOAP.

    I am assuming you will create a GET method providing your parameters and return the calculated value. With this in mind, assuming the calculation will not change during subsequent calls your result for a specific set of parameters will always be the same.

    You would therefor have a defined resource returning a consistent result for subsequent calls.

    Hope this helps,
    Chris

  • Ryan.LangtonRyan.Langton USMember

    Thanks,
    This makes me lean towards REST and is in line with my initial gut feeling (reservations about using SOAP with a mobile app). A coworker has suggested I use an HttpPost instead. I don't agree with this but maybe it's a possibility, would anyone go in that direction?

  • ChristiaanJPvanWykChristiaanJPvanWyk ZABeta, University, Developer Group Leader ✭✭

    POST is normally used to create a resource where PUT is used to update said resource.

    With this in mind, if the calculation is potentially long running and you need to be able to reference the result at a later point in time a POST could make sense, your POST could return reference to your calculation result or the result. You would then be able to request the resource via a GET specifying the resource id.

    I think at the end of the day it boils down to what your intended use is. This makes the answer very much an "it depends" kind of answer.

  • KrumelurKrumelur DEUniversity ✭✭

    I don't see where you violate a REST principle. Go REST. Easy. Painless. And be sure to check out http://www.servicestack.net

Sign In or Register to comment.