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 = 'https://ras.biodiversity.aq/aphia.php/aphia.php?p=soap&wsdl=1'>
<cfset sp_name = 'Aptenodytes'>
<cfinvoke
webservice="#worms_endpoint#"
method="getAphiaId"
returnvariable="AphiaID">
<cfinvokeargument name="scientificname" value="#sp_name#"/>
<cfinvokeargument name="marine_only" value="true"/>
</cfinvoke>
<p>Example 1. method getAphiaId - find aphiaId for 'Aptenodytes' - returns <cfoutput>#AphiaID#</cfoutput></p>
<cfset tid = 206442>
<cfinvoke
webservice="#worms_endpoint#"
method="getAphiaNameByID"
returnvariable="taxa_name">
<cfinvokeargument name="AphiaID" value="#tid#"/>
</cfinvoke>
<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>
<cfinvoke
webservice="#worms_endpoint#"
method="getAphiaRecordByID"
returnvariable="AphiaRecords">
<cfinvokeargument name="AphiaID" value="#tid#"/>
</cfinvoke>
<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'>
<cfinvoke
webservice="#worms_endpoint#"
method="getAphiaRecords"
returnvariable="AphiaRecords">
<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"/>
</cfinvoke>
- Number of getAphiaRecords found = <cfoutput>#arrayLen(AphiaRecords)#</cfoutput>
Step 3: Run the script
Invoke using Apache web server i.e. http://127.0.0.1/worms_test.cfm
Download this example.
Credits for this tutorial go to Dave Watts (Data Centre, CSIRO Oceans and Atmosphere, Australia)