Monday, 12 November 2012

A Perl client and REST wrapper for the CiteXplore SOAP webservices

OBSOLETE! See the official EuropePMC REST API which is now used within SEQwiki in this template.



As part of my ongoing plan for world domination, I decided to write a REST wrapper for the SOAP webservice provided by CiteXplore, the EBI's Citation Database. At first I thought this might be a daunting task. However, CPAN and the nice people on freenode came to the rescue, as usual.


First, I installed SOAP::WSDL locally using my usual recipe, and then simply pointed the handy script it provides at the WSDL for the CiteXplore SOAP webservices:

wsdl2perl.pl -b CXPSC URL


This 'auto-created' the Perl client for the webservice. What impressed me most was the resulting perldoc, that told me exactly how to use the Perl client. For example, typing:

perldoc CXPSC/MyInterfaces/WSCitationImplService/WSCitationImplPort.pm


gave this output. Using the POD and CiteXplore's Web Services Reference Guide I created a simple test script that even works!


Next came the task of wrapping these functions in a REST server. Some people on freenode told me to use Mojolicious::Lite. Although it's trendy, it also seems to work with minimal fuss.

Here it is, but it isn't pretty:
https://github.com/dbolser/Perl-CiteXplore-SOAP-client/blob/master/rest_script.plx


Finally I used the newly created REST interface to pull citation data into SEQwiki using the External Data extension. Setting up the execution environment using App::perlbrew (my webhost didn't have the requisite version of Perl for Mojo) was also much easier than I imagined.


THE END

4 comments:

Kill Face said...

Note, CiteXplore is now known as Europe PubMed Central.

Unknown said...

Note, CiteXplore is currently beta-testing a REST-full API. I guess mine was too hacky ;-)

Unknown said...

The official RESTfull webservice is now live:
http://europepmc.org/RestfulWebService

Unknown said...

http://europepmc.org/RestfulWebService ... sigh