Calling the WoRMS webservice from R

This tutorial assumes you have installed R version 2.x or 3.x (<3.2) (See http://www.r-project.org/).
Available for MacOS X, Linux & Windows.

Paste the following code in the R Console (this is just an example)
install.packages("XML", repos = "http://cran.r-project.org", dependencies = TRUE)
download.file("http://www.omegahat.net/Prerelease/XMLSchema_0.8-0.tar.gz", "XMLSchema")
install.packages("XMLSchema", type="source", repos = NULL)
download.file("http://www.omegahat.net/Prerelease/SSOAP_0.91-0.tar.gz", "SSOAP")
install.packages("SSOAP", type="source", repos = NULL)
w = processWSDL("http://www.marinespecies.org/aphia.php?p=soap&wsdl=1")
iface = genSOAPClientInterface(, w)
AphiaID = iface@functions$getAphiaID("Solea solea",1,('http://www.marinespecies.org/aphia.php?p=soap'))
#should output '[0] 127160'
Note 1: if you come across this error:
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
It means you have not the latest versions of SSOAP (0.91-0) and/or XMLSchema (0.8-0).

Note 2: when using the function getAphiaRecordByID(), the 'class' propery is empty. This looks like a limitation of the SSOAP package.

Note 3: If none of this works, just try the rOpenSci library 'worrms', available here: https://github.com/ropensci/worrms

Download this example.
Download elaborate example.