Using Web Services Tutorial
October 28, 2010 in Teaching
In this tutorial you will learn how to find Web Service feeds and you will get to transform them into a list of results formatted with the colour and font of your choice. I have prepared a set of PHP files for the Web Service Transformer that will help me demonstrate the power of XML. If you want to continue to work with this I have published them under a creative commons license allowing you to use and make changes to them.
First let’s have a look at the Web Service Transformation interface. This is a simple form which allows you to submit some parameters that will determine the outcome of the list.
The first parameter is Web Service. For this parameter you need to find a XML feed. Here are some places you can go to find these feeds:
The second parameter is Tag. If we use the example from the Flickr API again we can use the Flickr URL for the method flickr.photosets.getPhotos calling the photoset with the ID = 72157622862470902
The photo-set id can be found in the URL when you look at the photoset on Flickr. The same goes for photos and collections. For group ID and Flickr User ID you can use the idGettr tool where you copy/paste the URL and it gives you the ID.
If we input this URL into the interface and check the Print XML only box we will see the XML returned. From this XML we can pick out a tag to use e.g. <photo>
The third parameter is Attribute which allows you to choose an attribute from the tag you chose earlier. In this case I will choose title. Note that this parameter is optional.
The fourth parameter is Colour – have a look at COLOURlover for inspiration.
The parameters input are used to build an XSLT file which transforms the XML from the Web Service into HTML in the colour and font you chose.
- Use Flickr Explorer to display a description of a photo from the Vindolanda Fort at Hadrian’s Wall in a red shade and a font beginning with ‘G’
- Use Flickr Explorer to display the amount of members in the flickr group ‘Roman Empire’ in a shade of blue and a font beginning with ‘B’
- Using APPELLO for the Vindolanda tablets display a list of geographical places with the letter ‘b’ in the name in a green shade and a font of your choosing
- Using APPELLO for the Vindolanda tablets display a list of people named ‘flauius’ each with the tablets they occur in listed below the name in a purple shade and a font of your choosing
- Using the Baby Name API display your own name in your favorite colour and a font that begins with the same letter as your name