To start with, I get everyone to build a “My First Web Service” – basically a page that encodes an array into JSON. Since we’ll be working on numerous practical examples, this is a good chance for everyone to make sure that their setup works!
The next section is a diversion into talking about JSON itself and about HTTP theory. We’ll also talk about how XML fits into the picture and look at how to work with that.
At this point, we’ve broken the back of the theory stuff, and things get a bit more fun. We write a client to consume “My First Web Service” … so now we have client and server, everything builds up from there.
Time to show off the PHP Soap libraries and we build a Soap server and client. This is easy but I’ll also cover how to debug things – Soap is like the awkward middle child, it’s either wonderful or completely broken, so troubleshooting is a key skill!
We’re back then into “normal” RPC style services, illustrated by taking a look at what some existing sites offer (I use flickr as an example usually but one day I’ll find some other alternatives to mix things up!) and extending our service to wrap the same class we used for the Soap example.
In the final section, we look at RESTful services, and how to build one for real. If this seems like a lot of content – it is! The practical work is all “play along”, I make my code available and demo as I go, but I won’t hold up the workshop to get everyone in the room to a working example. As a result all the various bits and pieces are “here’s one I made earlier” or are independent of one another.
Finally, I close with some words about delivering and supporting services. There are design recommendations scattered throughout the presentation, but pulling those ideas together and keeping an eye firmly on how things look from the user’s point of view is absolutely vital, and hopefully that will come across.
I’m so excited about giving this tutorial at PHPNW, it’s had good reviews elsewhere and I think it’s genuinely useful with so much inter-application data transfer in today’s applications. If you’rope to see you in Manchester :)