cross-screen marketing solutions

REST assured – you don’t need SOAP

soaprest1

Overcoming the barriers of mobile web design and development – it’s the tagline of our blog and something that we strive towards each and every day.

We’ve given the development community some amazing tools that allow you to create some fantastic mobile sites and we’ve created plugins, components and classes that help you at every step.

But one thing every Wapple Architect application has in common, is that in order to use it, it must be done via SOAP.

Or should I say, used to have in common, because this week we’ve created and released a REST web service for every SOAP call you can make.

Using Wapple Architect with CURL

What this means as a developer is that you can choose whichever method you want to communicate with Wapple Architect. If you want to use SOAP, carry on doing what you’ve always done, but if you want to use REST, use it. And to show how easy that can be, here’s how you would check if a visitor to your site is mobile or not using PHP and CURL:

<?php
$headers = '';
foreach($_SERVER as $key => $val)
{
 $headers .= $key.':'.$val.'|';
}
$postfields = array(
 'devKey' => 'YOUR_DEV_KEY',
 'headers' => $headers
);
$c = curl_init();
curl_setopt($c, CURLOPT_URL, 'http://webservices.wapple.net/isMobileDevice.php');
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($c);
curl_close($c);
if($result)
{
 // We're a mobile device! Generate some WAPL and use getMarkupFromWapl.php service!
} else
{
 // Not a mobile device - generate HTML and output to screen.
}
?>

Once you’ve established that your visitor is a mobile visitor, you can use the getMarkupFromUrl.php or getMarkupFromWapl.php services and amend your $postfields array to include the ‘url’ or ‘wapl’ keys respectively.

Architect with SOAP or REST

So if you’ve looked at using Wapple Architect before but for one reason or another couldn’t or wouldn’t install SOAP, you’ve now got another option that allows you to mobilize your site or app!

We’ve already integrated these new services into our Wapple Architect Mobile Plugin for WordPress so that if you don’t have SOAP installed on your server, you automatically fall back to using REST. And lets face it, if you’re on a shared host, getting SOAP installed is not a task to be taken lightly and can be tricky.

What do you think of these new REST services, does it mean you’ll use Wapple Architect? Do we need even more coverage of web services – XMLRPC for example? Get in touch and let us know!

One Response

  1. Henry Goodwin says:

    XMLRPC would be jolly useful!
    Good show on the REST though, you’ve earned it! (ho ho)