Intro | Search taxa | Taxon tree | Sources | Webservice | Statistics | Editors | Log in

Calling the RAS 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, 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 = ''>

<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 = 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)

This service is powered by LifeWatch Belgium
Learn more»
Website and databases developed and hosted by VLIZ · Page generated 2024-05-28 · contact: Anton Van de Putte