1

I am completing a website that I have developed in object oriented PHP.

It would be great if I could open my Application up to Windows Phone (because I love look and feel of the platform).

I have explored opening my application up by making use of the PHP SoapServer class. I've also looked at REST and retrieving data for my application as JSON, but it feels like a bitty solution.

Therefore, I would like to ask for advice on the following:

  • Is the SoapServer class the de facto technique for opening a PHP application up so that another platform (Windows Phone) can make use of it's classes/functions? Or are there other ways that I should consider "opening" my application up?
Luke
  • 22,826
  • 31
  • 110
  • 193

1 Answers1

2

You can do several things, but the most used are the two you mentioned: SOAP and REST. There is no de facto standard. To be clear, because we are talking API here, there is no real difference between the fact you are using PHP (much less if it is object oriented or not), apart from how easy it is to handle your selected method server side.

I'm not a big fan of SOAP myself, especially in PHP. The support is not very good, but my experience in this is mostly in consuming SOAP, not serving it. Much of the advantages you get from reading your stuff from the .wsdl are gone if you cannot auto-import them // auto-create your classes, and the default SOAP implementation is a little too fond of just saying "segmentation error" in some cases.

That being said, your 2 choices are roughly devided by

  • SOAP: Stricter, more of an enterprise-setting, more difnitions and maybe therefore more control / forcing of standards. On the other hand, it can be complicated to use client-side
  • REST: More agile, very easy to understand for users of your API. On the other hand it does tend to create less consistent API, but that is not a given: you could be very precise in your definitions and not have this problem.

Personally I would choose a REST system in this environment. You can make your REST environment serve XML just as wel ofcourse, if you don't like JSON.

Nanne
  • 64,065
  • 16
  • 119
  • 163
  • REST it is then :). I see what you're saying about the WSDL, it is a pain to maintain too from what I can see, so there isn't really a benefit to SOAP in this instance. – Luke Jan 04 '13 at 09:44
  • If it is a big project you might want to be a bit oldscool in your implementation, that is, all sorts of design things first : this can help in making it consistent. Be sure to use POST/GET/DELETE/PUT requests as they are intended so you get a good designed API ;). Take a look at this question (well, the answer): http://stackoverflow.com/questions/4573305/rest-api-why-use-put-delete-post-get – Nanne Jan 04 '13 at 09:48
  • That is a fantastic post, I have added it as a favourite. Let the development commence.... – Luke Jan 04 '13 at 10:01