RAMS logo
Introduction | Species lists | Search taxa | Taxon tree | Literature | Distributions | Statistics | Editors | Match taxa | Webservice | Log in

Calling the RAMS webservice from ColdFusion/Railo/Lucee

The following scripts are applicable to the commercial web application ColdFusion (Adobe) and it's open source equivalents of Railo and Lucee.
The scripts have been tested on Lucee which is a sucessor to Railo.

Step 1: Install Lucee
Go to www.lucee.org, download & install Lucee (Windows or Linux). The Linux version in particular will link Lucee to Apache so the webservices can be called on port 80.

Step 2: Create the script and save it as worms_test.cfm
Save it in a web accessable location.
<cfset worms_endpoint = 'http://www.marinespecies.org/rams/aphia.php?p=soap&wsdl=1'>

<cfset sp_name = 'Aptenodytes'>

    <cfinvokeargument name="scientificname" value="#sp_name#"/>
    <cfinvokeargument name="marine_only" value="true"/>

<p>Example 1. method getAphiaId - find aphiaId for 'Aptenodytes' - returns <cfoutput>#AphiaID#</cfoutput></p>

<cfset  tid = 206442>
    <cfinvokeargument name="AphiaID" value="#tid#"/>

<p>Example 2. method getAphiaNameByID - find name for AphiaID 206442 - returns <cfoutput>#taxa_name#</cfoutput></p>

<p>Example 3. method getAphiaRecordByID - find full record for AphiaID 235339 and place it into a data structure

<cfset  tid = 235339>
    <cfinvokeargument name="AphiaID" value="#tid#"/>

<cfset data.kingdom = AphiaRecords.getKingdom()>
<cfset data.phylum  = AphiaRecords.getPhylum()>
<cftry><cfset data.class = AphiaRecords.getClass()><cfcatch></cfcatch></cftry>
<cfset data.order = AphiaRecords.getOrder()>
<cfset data.family = AphiaRecords.getFamily()>
<cfset data.genus = AphiaRecords.getGenus()>
<cfset data.Scientificname = AphiaRecords.getScientificname()>
<cfset data.authority = AphiaRecords.getValid_authority()>
<cfset data.rank = AphiaRecords.getRank()>
<cfset data.status = AphiaRecords.getStatus()>
<cfset data.url_string = AphiaRecords.getUrl()>
<cfset data.lsid = AphiaRecords.getLsid()>

<cfdump var="#data#">

<p>Example 4. method getAphiaRecords - find multiple records for 'Pygoscelis'

<cfset sp_name = 'Pygoscelis'>

    <cfinvokeargument name="scientificname" value="#sp_name#"/>
    <cfinvokeargument name="like" value="true"/>
    <cfinvokeargument name="fuzzy" value="true"/>
    <cfinvokeargument name="marine_only" value="true"/>
    <cfinvokeargument name="offset" value="1"/>

 - Number of getAphiaRecords found = <cfoutput>#arrayLen(AphiaRecords)#</cfoutput>

Step 3: Run the script
Invoke using Apache web server i.e.

Download this example.

Credits for this tutorial go to Dave Watts (Data Centre, CSIRO Oceans and Atmosphere, Australia)

Website and databases developed and hosted by VLIZ · Page generated 2018-01-21 GMT · contact: Anton Van de Putte