web services

Authenticating A Drupal User From A Third Party

Before we get started I'm posting this code for reference but, had it occurred to me, I would have worked on adub's Clients module instead of starting totally from scratch. It didn't until after the fact, but if you find yourself in a similar situation then I implore you to join the effort to make a Clients API for Drupal to be a companion for the Services module, instead of writing custom code like I did.

Strict Typing And XML-RPC

You may or may not be aware web services are very strictly typed (well, XML is, period). That means if you send a web service a string, e.g. '233', when it wants an integer, e.g. 233 (note the very subtle difference) it will break!

Consider this XML-RPC call to the Services module in Drupal:

<?php
$nid
= 144;
$result = xmlrpc('<a href="http://www.mydomain.com/services/xmlrpc'">http://www.mydomain.com/services/xmlrpc'</a>, 'file.getNodeFiles', $nid);
?>

This will make Drupal's XML-RPC handling functions build the following XML envelope to send to the web service at http://www.mydomain.com/services/xmlrpc:

Complex Calls With Soap Client

I've just started using the SOAP Client module in Drupal to handle SOAP requests. It's a great little tool. If you set it to use the nuSOAP PHP libraries (instead of core) it even handles Microsoft datasets, which some Microsoft-based web services will return.

There is one small problem. Documentation is approximately zero! The only assistance offered is "look at the code of the admin test form", which is great for simple name/value pairs of data, but doesn't tackle complex types.

SOA And Drupal - The Services Module

So, you want to create an SOA-based infrastructure for some or all of your business tools and web sites? Not sure where to start?

I'll admit I have worked a little with Microsoft web services, but I am fairly ignorant of the open source alternatives out there for SOA. What I can tell you is I'm hugely impressed with the new Services module for Drupal. It is still in dev, but it's pretty cool!

Subscribe to RSS - web services
© 2010 Greg Harvey. Drupal theme by Kiwi Themes.