Archive for the Search Category

We have previously described initial steps to integrate ChemSpider with ELNs with IDBS, and to define the elnItemManifest metadata model.

We have now also made further steps to integrate ChemSpider with Southampton University’s ELN, LabTrove, following on from an eScience tool that Stephen Wan from CSIRO had developed with the University of New South Wales to text mine LabTrove ELN blog posts to identify chemical names and link these to the relevant ChemSpider compounds. LabTrove is an open source blog-based system which can be used for recording and sharing experimental findings. Previously, if an image of the compound was to be added to an experiment blog post, it would be necessary either to upload it as an image (following drawing it in a separate drawing package) or to paste in a link to the image in another website (following a separate internet search in another browser window). We have now added the ability to click a button directly when adding or editing an experiment to launch a search of ChemSpider and when the required compound is found, an image of it can be added to chemspider simply by clicking on it, as can be seen in this demonstration video:

The editing controls in LabTrove are based on TinyMCE, a WYSIWYG editor which is used in a range of blogs, including WordPress. This means that this same ChemSpider plugin can also be used to insert compound images from ChemSpider from any other blog or website that uses a TinyMCE editor too.

If you have a LabTrove installation which you would like to add the ChemSpider plugin to then simply update your installation with the latest source code from LabTrove’s SourceForge website.

If you have a website or blog which uses a TinyMCE editor which you would like to add the ChemSpider plugin to then simply download this zip file, extract the folder in it and move the “chemspider” directory created to your tinymce plugins folder. Then, in your tinymce initialization process, add the plugin “chemspider” and the button “chemspider”.

The eagle-eyed amongst you may have noticed that there was an update to ChemSpider just over a week ago. Many of the changes that were performed on the site were aimed at upgrading the underlying architecture of the site and ensuring that the performance of the ChemSpider site is constantly improving as the number of users of our site and services grows.

Here are a few of the changes to the site that are more visible:

  1. Clearer deprecation of records
  2. Citation details
  3. Visibility of average mass
  4. Layout of the structure search page
  5. Improvements to search messaging
  6. Clearer layout of the Experimental Properties section
  7. Support for foreign language help

So to pick out a few of the key items from the above list….


Clearer deprecation of records

ChemSpider is designed so that by default, deprecated records are not presented in your search results – this ensures that you don’t have to wade through data for records that are clearly wrong or lack any useful data. But, of course there may be occasions where you happen across a deprecated record. In the past, it wasn’t always easy to immediately see that a record had been deprecated and understand the reason that it had been deprecated. In the new design the notification message is far more prominent and we also make it easy to see the reason why the record was deprecated (this is new requirement in the deprecation process and so for older deprecations this field may be blank).


Citation details

We commonly get requests from individuals asking about including data from a ChemSpider record in a presentation or thesis. As outlined in our FAQ page, where individuals reuse data we ask that they cite ChemSpider. And so to make this process simpler we have created an output that contains the basic information that users may need to include in a citation, and we have provided a button that makes it really easy to copy the data to your clipboard in one click.

Looking at the above image you can also see that the Average mass (which was accidentally hidden for a while) has now been made visible the record again.

Layout of the structure search page

One of the most noticeable changes has been the rearrangement of the Structure search interface. While the actual functionality remains the same, the options have been presented in a way that (hopefully) makes it much easier to see all of the options that are available to you when you perform a structure search. This is the 1st phase of our work on this interface, so please let us know what you think about the changes so far.


Clearer layout of the Experimental Properties section

Another significant change that we have made is to the presentation data in the Experimental properties infobox. The data is presented in a tidier layout, and while we have always had the ability to provide links to the original datasource, this was not particularly obvious to some users. In this new design we explicitly display the name of the datasource that provided the data, and wherever possible the name will act as a link back to the relevant page/entry in that datasource.

We hope that you find all of these new features useful, and as always we welcome your feedback on these and any other aspects of the site.

The functionality of electronic lab notebooks (ELNs) and that of ChemSpider overlap to a certain extent – both store chemical information including structures, data, spectra and reactions. However, the focus of most ELNs is to manage, track and audit that data, and that of ChemSpider is to publish and disseminate it to the world. We have been considering how best to use this complementary functionality to integrate an ELN with ChemSpider.

Some ELNs already currently look up information and link to ChemSpider. For example the blog3 Web-logging (“blogging”) engine by Jeremy Frey, Simon Coles and Mark Borkum at Southampton University, which allows links to compounds from the ChemSpider database to be embedded directly into the content of a post. When a link to ChemSpider is detected, blog3 follows the link to retrieve additional information that is relevant to the compound, including: experimental and theoretical data; two- and three- dimensional depictions; and links to papers and journal articles. Another example is the eScience tool that Stephen Wan from CSIRO has developed with the University of New South Wales to text mine LabTrove ELN blog posts to identify chemical names and link these to the relevant ChemSpider compounds.

At the meeting “The Smart Laboratory: Towards a national ELN” meeting (organised as part of the Dial-a-Molecule EPSRC Grand Challenge) in August this year, the seeds were sown to take the integration between ELNs and ChemSpider a step further. Cambridge University has the first Chemistry department in the UK to roll out a department-wide Electronic Lab notebook system, and the software that they’re using is IDBS’s E-WorkBook Suite. In collaboration with IDBS and Cambridge’s Chemistry department, we at ChemSpider have made a plug-in which could both dynamically retrieve information from ChemSpider into their ELN, and publish to it the other way. The Chemistry department at Cambridge (Dr Tim Dickens, Dr Brian Brooks, Prof Bobby Glenn and Prof Steven Ley) have been very helpful in granting access to their ELN to write the plug-in, and will be its first users, but the results will be freely available for any existing IDBS E-WorkBook suite user.

About the extension Prof Bobby Glenn has said: “Much of Chemistry is lost, it is simply not published and languishes in forgotten lab notebooks. Capturing novel molecules soon after synthesis on a searchable database like Chemspider is now an effortless process directly from the ELN, which will greatly encourage sharing of compounds, synthetic methods and all the associated data. It’s instant messaging for chemists”. Antony Williams (Vice-President of Strategic Development of ChemSpider) added “The ability to now publish compound data from the IDBS ELN directly to ChemSpider offers a path to direct exposure of novel chemistry as well as the chemist doing the work. This public compound registration capability is the first move towards ultimately exposing synthetic methods and associated experimental data to the community. Our vision is coming to fruition through this collaboration.”

To view the plug-in in action please view the demonstration movie of ChemSpider E-WorkBook Suite Plugin.

Screen capture of launching Publish to ChemSpider plug-in

Compounds can be published to ChemSpider if they have been drawn out in full in an experiment – whether this is as an individual structure or part of a reaction, and whether they are simply uploaded into the experiment as a reaction file, or included in for example a spreadsheet item. Likewise, compound structures can be automatically loaded into a search of ChemSpider if you would like to find out more information about compounds that have been drawn out in full in an experiment, or if you have published a compound to ChemSpider and wish to see the resulting compound pages. The resulting compound pages in ChemSpider will have the data source “IDBS E-WorkBook Suite”. The external ID will show the ID of the experiment from which the structures are from, and the depositor details as defined in the ChemSpider Settings of the ELN.

The ChemSpider IDBS E-WorkBook Suite plug-in is freely available to customers of IDBS E-WorkBook Suite by downloading it from IDBS, and copying it the appropriate place in their IDBS E-WorkBook Suite program files. It is compatible with E-WorkBook Suite versions 9.0 and 9.1.

This plug-in is an initial proof-of-concept to demonstrate that we can pass compound information between ChemSpider and an ELN in both directions. Future versions will allow more of the information within an experiment to be published to ChemSpider – for example to allow reactions along with a description of their methods to be published to ChemSpider SyntheticPages, or to deposit spectra along with compounds to ChemSpider. We would also like to integrate other ELNs with ChemSpider.

Recently I have been programming a java plug-in from which I needed to call the ChemSpider webservices, and I found that this wasn’t as straightforward as I was expecting, so I thought I would post how to do it in case it’s useful for anyone else who wants to do likewise.
The basic method I used was to use Apache Axis2 to generate java code for the WSDL’s of the main ChemSpider webservices. This java code is available here: and I have also made the compiled jar file available here: chemspider_webservices.jar. The ChemSpider webservices can be called from other java code by referencing this jar file (and the other axis library files).
This blog post describes how I generated and used this jar file. I was using the Eclipse IDE, so some of what I describe will be specific to that.
There is a similar jar file of some ChemSpider webservices which is available by downloading MZMine (the file chemspider-api.jar in the lib directory) and an example of its use can be seen by downloading the source code and looking at the file src\net\sf\mzmine\modules\peaklistmethods\identification\dbsearch\databases\ That jar file was generated using the previous version of Axis (just plain Axis, rather than Axis2) compared to this one. The example here may be easier to use as a start point since the full range of ChemSpider webservices are included in the jar file, there is a full description of how it was generated, the code used to generate the jar file is available and there are more examples of its use.

Generating the chemspider_webservices.jar file

To generate the java code from the WSDL of the ChemSpider webservices I used the WSDL2Java functionality of Apache Axis2. This is available in different forms, including an Eclipse plug-in which will directly import the java code generated into a project, but I found various bugs when trying to use the latest version of that, so just used the command line version.
I started off with generating the java code from the WSDL of the ChemSpider MassSpecAPI webservice:

  • I downloaded and unzipped the latest version of the Apache Axis2 binary distribution from their download page. I used version 1.6.1 of Axis2.
  • In the “bin” directory of this download there should be a file called java2wsdl.bat. Running this batch file from a command line saves a lot of time trying to set up the class paths correctly to run Java2WSDL. Before using it you should set up the following two environment variables:
    • AXIS2_HOME: Must point to the top level of the AXIS2 files which you just downloaded
    • JAVA_HOME: Must point at your Java Development Kit installation direcotry (e.g. C:\Program Files\Java\jre6)
  • To see a full list of the options available when running WSDL2Java simply open a command prompt and run the batch file with no options to obtain the Usage options – more information about these can be found in the Apache Axis2 user guide:
    • > axis2-1.6.1\bin\wsdl2java.bat
  • I ran it with options to specify to use the SOAP 1.2 port of the ChemSpider MassSpecAPI webservice (most ChemSpider webservices have the option of SOAP 1.1, SOAP 1.2, HTTP GET or HTTP POST), to generate synchronous code only (not asynchronous), and to use adb databinding (this is the default anyway):
    • > axis2-1.6.1\bin\wsdl2java.bat -uri -pn MassSpecAPISoap12 -s -d adb
  • This then generated the file which it automatically put in the package com.chemspider.www (so was the appropriate folder structure was created above it accordingly)
  • I repeated this processes with the other 4 main ChemSpider webservices:
    • > axis2-1.6.1\bin\wsdl2java.bat -uri -pn SearchSoap12 -s -d adb
    • > axis2-1.6.1\bin\wsdl2java.bat -uri -pn InChISoap12 -s -d adb
    • > axis2-1.6.1\bin\wsdl2java.bat -uri -pn SpectraSoap12 -s -d adb
    • > axis2-1.6.1\bin\wsdl2java.bat -uri -pn OpenBabelWebServiceSoap12 -s -d adb
  • The folders and java class files generated by Java2WSDL (,,, and that were generated are available in the zip file for further reference
  • I then started a new Eclipse project, imported this generated File system into it
  • The generated classes rely on the Axis2 library files so these need to be added to the build path – in Eclipse this is done by right-clicking on the project in the Package Explorer, choosing Properties > Java Build Path > Libraries > Add External Jars and selecting all of the lib files in the lib folder of the Axis2 folder.
  • This project was exported as the jar file chemspider_webservices.jar

Using the chemspider_webservices.jar file as an external library jar file

The chemspider_webservices.jar file and all of the Apache Axis2 library jar files need adding to a java project as referenced libraries before it can be called. To do this in Eclipse right-click on the project in the Package Explorer, choose Properties > Java Build Path > Libraries > Add External Jars and select:

  • the chemspider_webservices.jar file (download it from chemspider_webservices.jar and save it locally)
  • all of the lib files in the lib folder of the Axis2 folder.

Once this has been done then the ChemSpider webservices can be called from the project. An example is shown below, and is also downloadable in text format from here. This has been structured into (pretty well self-contained) functions which can be easily called to retrieve the results of a particular operation of a webservice. In the main function these functions are called and the output written out.

Please note that you should put your obtains your own ChemSpider token from ChemSpider to set as the ChemSpiderToken value – to obtain this, register for a ChemSpider account, and look up your token from your user Profile page after logging in. Some tokens require your user account to be associated with the “Service Subscriber” role, which you can request from your user profile page.

package com.chemspider.www.examples;

import java.util.HashMap;
import java.util.Map;

import javax.swing.JOptionPane;

import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;

import com.chemspider.www.*;
import com.chemspider.www.InChIStub.InChIToCSIDResponse;
import com.chemspider.www.SearchStub.GetAsyncSearchResultResponse;
import com.chemspider.www.SearchStub.GetAsyncSearchStatusResponse;
import com.chemspider.www.SearchStub.SimpleSearchResponse;
import com.chemspider.www.MassSpecAPIStub.ArrayOfInt;
import com.chemspider.www.MassSpecAPIStub.ArrayOfString;
import com.chemspider.www.MassSpecAPIStub.ExtendedCompoundInfo;
import com.chemspider.www.MassSpecAPIStub.GetDatabasesResponse;
import com.chemspider.www.MassSpecAPIStub.GetExtendedCompoundInfoArrayResponse;
import com.chemspider.www.MassSpecAPIStub.SearchByMassAsyncResponse;

public class WebServiceExamples {

* @param args

private static final Logger LOG = Logger.getLogger(WebServiceExamples.class.getName());

private static String ChemSpiderToken = "YOU NEED TO INSERT YOUR OWN TOKEN IN HERE";

public static void main(String[] args) {

JOptionPane.showMessageDialog(null, "The compound with InChI InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H has CSID:"+get_InChI_InChIToCSID_Results("InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H"));

int[] SimpleSearchResults = get_Search_SimpleSearch_Results("taxol", ChemSpiderToken);
JOptionPane.showMessageDialog(null, "The first of "+SimpleSearchResults.length+" ChemSpider compound(s) returned by a search for Taxol has CSID:"+SimpleSearchResults[0]);

int[] inputCSIDs = new int[2];
inputCSIDs[0] = 236;
inputCSIDs[1] = 238;
Map> GetExtendedCompoundInfoArrayResults = get_MassSpecAPI_GetExtendedCompoundInfoArray_Results(inputCSIDs, ChemSpiderToken);
Map thisCompoundInfo = GetExtendedCompoundInfoArrayResults.get(238);
JOptionPane.showMessageDialog(null, "The Average Mass of the compound with CSID 238 is: "+thisCompoundInfo.get("AverageMass"));

String[] GetDatabaseResults = get_MassSpecAPI_GetDatabases_Results();
JOptionPane.showMessageDialog(null, "The first of "+GetDatabaseResults.length+" datasources in ChemSpider is:"+GetDatabaseResults[0]);

String SearchByMassAsyncResults = get_MassSpecAPI_SearchByMassAsync_Results(1100.0, 0.1,GetDatabaseResults, ChemSpiderToken);
JOptionPane.showMessageDialog(null, "Transaction ID for search on compounds with mass = 1100+/- 0.1 from any data source is" + SearchByMassAsyncResults);
JOptionPane.showMessageDialog(null, "The operation status of the search with this transaction ID is" + get_Search_GetAsyncSearchStatus_Results(SearchByMassAsyncResults, ChemSpiderToken));
int[] GetAsyncSearchResultResults = get_Search_GetAsyncSearchResult_Results(SearchByMassAsyncResults, ChemSpiderToken);
JOptionPane.showMessageDialog(null, "And the first of "+GetAsyncSearchResultResults.length+" ChemSpider compound(s) returned by the search has CSID:"+GetAsyncSearchResultResults[0]);

* Function to call the InChIToCSID operation of ChemSpider's InChI SOAP 1.2 webservice (
* Convert InChI to ChemSpider ID.
* @param inchi: string representing inchi to search ChemSpider for
* @return: string representing CSID returned
public static String get_InChI_InChIToCSID_Results(String inchi) {
String Output = null;
try {

final InChIStub thisInChIstub = new InChIStub();
com.chemspider.www.InChIStub.InChIToCSID InChIToCSIDInput = new com.chemspider.www.InChIStub.InChIToCSID();
final InChIToCSIDResponse thisInChIToCSIDResponse = thisInChIstub.inChIToCSID(InChIToCSIDInput);
Output = thisInChIToCSIDResponse.getInChIToCSIDResult();
} catch (Exception e) {
LOG.log(Level.ERROR, "Problem retrieving ChemSpider webservices", e);
return Output;

* Function to call the SimpleSearch operation of ChemSpider's Search SOAP 1.2 webservice (
* Search by Name, SMILES, InChI, InChIKey, etc. Returns a list of found CSIDs (first 100 - please use AsyncSimpleSearch instead if you like to get the full list). Security token is required.
* @param query: String representing search term (can be Name, SMILES, InChI, InChIKey)
* @param token: string containing your user token (listed at your page)
* @return: int[] array containing the ChemSpider IDs. If more than 100 are found then only the first 100 are returned.
public static int[] get_Search_SimpleSearch_Results(String query, String token) {
int[] Output = null;
try {
final SearchStub thisSearchStub = new SearchStub();
com.chemspider.www.SearchStub.SimpleSearch SimpleSearchInput = new com.chemspider.www.SearchStub.SimpleSearch();
final SimpleSearchResponse thisSimpleSearchResponse = thisSearchStub.simpleSearch(SimpleSearchInput);
Output = thisSimpleSearchResponse.getSimpleSearchResult().get_int();
} catch (Exception e) {
LOG.log(Level.ERROR, "Problem retrieving ChemSpider webservices", e);
return Output;

* Function to call the GetDatabases operation of ChemSpider's MassSpecAPI SOAP 1.2 webservice (
* Get the list of datasources in ChemSpider.
* @return: the list of datasources in ChemSpider as a String Array
public static String[] get_MassSpecAPI_GetDatabases_Results() {
String[] Output = null;
try {

final MassSpecAPIStub thisMassSpecAPIStub = new MassSpecAPIStub();
com.chemspider.www.MassSpecAPIStub.GetDatabases getDatabaseInput = new com.chemspider.www.MassSpecAPIStub.GetDatabases();
final GetDatabasesResponse thisGetDatabasesResponse = thisMassSpecAPIStub.getDatabases(getDatabaseInput);
Output = thisGetDatabasesResponse.getGetDatabasesResult().getString();
} catch (Exception e) {
LOG.log(Level.ERROR, "Problem retrieving ChemSpider webservices", e);
return Output;

* Function to call the GetExtendedCompoundInfoArray operation of ChemSpider's MassSpecAPI SOAP 1.2 webservice (
* Get array of extended record details by an array of CSIDs. Security token is required.
* @param CSIDs: integer array containing the CSIDs of compounds for which information will be returned
* @param token: string containing your user token (listed at your page)
* @return: a Map> containing the results array for each CSID (with Properties CSID, MF, SMILES, InChIKey, AverageMass, MolecularWeight, MonoisotopicMass, NominalMass, ALogP, XLogP, CommonName)
public static Map> get_MassSpecAPI_GetExtendedCompoundInfoArray_Results(int[] CSIDs, String token) {
Map> Output = new HashMap>();
try {
final MassSpecAPIStub thisMassSpecAPIStub = new MassSpecAPIStub();
ArrayOfInt inputCSIDsArrayofInt = new ArrayOfInt();
com.chemspider.www.MassSpecAPIStub.GetExtendedCompoundInfoArray getGetExtendedCompoundInfoArrayInput = new com.chemspider.www.MassSpecAPIStub.GetExtendedCompoundInfoArray();
final GetExtendedCompoundInfoArrayResponse thisGetExtendedCompoundInfoArrayResponse = thisMassSpecAPIStub.getExtendedCompoundInfoArray(getGetExtendedCompoundInfoArrayInput);
ExtendedCompoundInfo[] thisExtendedCompoundInfo = thisGetExtendedCompoundInfoArrayResponse.getGetExtendedCompoundInfoArrayResult().getExtendedCompoundInfo();
for (int i=0; i Map thisCompoundExtendedCompoundInfoArrayOutput = new HashMap();
thisCompoundExtendedCompoundInfoArrayOutput.put("CSID", Integer.toString(thisExtendedCompoundInfo[i].getCSID()));
thisCompoundExtendedCompoundInfoArrayOutput.put("MF", thisExtendedCompoundInfo[i].getMF());
thisCompoundExtendedCompoundInfoArrayOutput.put("SMILES", thisExtendedCompoundInfo[i].getSMILES());
thisCompoundExtendedCompoundInfoArrayOutput.put("InChI", thisExtendedCompoundInfo[i].getInChI());
thisCompoundExtendedCompoundInfoArrayOutput.put("InChIKey", thisExtendedCompoundInfo[i].getInChIKey());
thisCompoundExtendedCompoundInfoArrayOutput.put("AverageMass", Double.toString(thisExtendedCompoundInfo[i].getAverageMass()));
thisCompoundExtendedCompoundInfoArrayOutput.put("MolecularWeight", Double.toString(thisExtendedCompoundInfo[i].getMolecularWeight()));
thisCompoundExtendedCompoundInfoArrayOutput.put("MonoisotopicMass", Double.toString(thisExtendedCompoundInfo[i].getMonoisotopicMass()));
thisCompoundExtendedCompoundInfoArrayOutput.put("NominalMass", Double.toString(thisExtendedCompoundInfo[i].getNominalMass()));
thisCompoundExtendedCompoundInfoArrayOutput.put("ALogP", Double.toString(thisExtendedCompoundInfo[i].getALogP()));
thisCompoundExtendedCompoundInfoArrayOutput.put("XLogP", Double.toString(thisExtendedCompoundInfo[i].getXLogP()));
thisCompoundExtendedCompoundInfoArrayOutput.put("CommonName", thisExtendedCompoundInfo[i].getCommonName());
Output.put(thisExtendedCompoundInfo[i].getCSID(), thisCompoundExtendedCompoundInfoArrayOutput);

} catch (Exception e) {
LOG.log(Level.ERROR, "Problem retrieving ChemSpider webservices", e);
return Output;

* Function to call the SearchByMass2 operation of ChemSpider's MassSpecAPI SOAP 1.2 webservice (
* Search ChemSpider by mass +/- range.
* @param Mass: The compounds returned have a mass (Double) within the range Mass +/- Range
* @param Range: The compounds returned have a mass (Double) within the range Mass +/- Range
* @return: the ChemSpider IDs of compounds returned (as a String Array)
public static String get_MassSpecAPI_SearchByMassAsync_Results(Double mass, Double range, String[] dbs, String token) {
String Output = null;
try {
final MassSpecAPIStub thisMassSpecAPIStub = new MassSpecAPIStub();
com.chemspider.www.MassSpecAPIStub.SearchByMassAsync getSearchByMassAsyncInput = new com.chemspider.www.MassSpecAPIStub.SearchByMassAsync();
ArrayOfString inputDBsArrayofString = new ArrayOfString();
final SearchByMassAsyncResponse thisSearchByMassAsyncResponse = thisMassSpecAPIStub.searchByMassAsync(getSearchByMassAsyncInput);
Output = thisSearchByMassAsyncResponse.getSearchByMassAsyncResult();
} catch (Exception e) {
LOG.log(Level.ERROR, "Problem retrieving ChemSpider webservices", e);
return Output;

* Function to call the GetAsyncSearchStatus operation of ChemSpider's Search SOAP 1.2 webservice (
* Query asynchronous operation status. Requires transaction ID returned by AsynchSearch operation. Security token is required.
* @param rid: String representing transaction ID returned from a previous search
* @param token: string containing your user token (listed at your page)
* @return: String describing status of this search - can have values Unknown or Created or Scheduled or Processing or Suspended or PartialResultReady or ResultReady or Failed or TooManyRecords
public static String get_Search_GetAsyncSearchStatus_Results(String rid, String token) {
String Output = null;
try {
final SearchStub thisSearchStub = new SearchStub();
com.chemspider.www.SearchStub.GetAsyncSearchStatus GetAsyncSearchStatusInput = new com.chemspider.www.SearchStub.GetAsyncSearchStatus();
final GetAsyncSearchStatusResponse thisGetAsyncSearchStatusResponse = thisSearchStub.getAsyncSearchStatus(GetAsyncSearchStatusInput);
Output = thisGetAsyncSearchStatusResponse.getGetAsyncSearchStatusResult().toString();
} catch (Exception e) {
LOG.log(Level.ERROR, "Problem retrieving ChemSpider webservices", e);
return Output;

* Function to call the GetAsyncSearchResult operation of ChemSpider's Search SOAP 1.2 webservice (
* Returns the list of CSIDs found by AsynchSearch operation. Security token is required.
* @param rid: String representing transaction ID returned from a previous search
* @param token: string containing your user token (listed at your page)
* @return: int[] array containing the ChemSpider IDs.
public static int[] get_Search_GetAsyncSearchResult_Results(String rid, String token) {
int[] Output = null;
try {
final SearchStub thisSearchStub = new SearchStub();
com.chemspider.www.SearchStub.GetAsyncSearchResult GetAsyncSearchResultInput = new com.chemspider.www.SearchStub.GetAsyncSearchResult();
final GetAsyncSearchResultResponse thisGetAsyncSearchResultResponse = thisSearchStub.getAsyncSearchResult(GetAsyncSearchResultInput);
Output = thisGetAsyncSearchResultResponse.getGetAsyncSearchResultResult().get_int();
} catch (Exception e) {
LOG.log(Level.ERROR, "Problem retrieving ChemSpider webservices", e);
return Output;


Disclaimer: I’m new to Java programming, so please excuse me if you are a java expert and I’ve said something obvious, offended you with my code or used the wrong terminology anywhere.

In a way this is a taster, as we’re looking at our Search as part of the refresh of ChemSpider, and more detail will follow. Another motivation for posting was a couple of recent requests for ChemSpider functionality which is already available – a great pointer to how we think about offering massive functionality in a clear interface. The two requests? One was that it would be great if a user could do a search from an input image (so to load an image, convert to structure and launch a search). The other wanted a way to just look for compounds with a specific element included. Both of these can be done on ChemSpider – and tragically both came in as amonymous feature requests. So, because I don’t think they’ve even been fully itemised before, let me count the ways by which you can search ChemSpider.

Simple Search on ChemSpider








1. Search by name – systematic name, synonym, trade name
2. Search by chemical identifier – InChI, InChIKey, SMILES
3. Search by database identifier – registry number

Structure Search on ChemSpider













4. Search by exact structure drawn, substructure, similarity – exact match, all tautomers, same skeleton (including/excluding H), all isomers
5. Draw an exact structure – in one of several structure drawers

Load a structure file from an image





6. Load from mol, sdf, skc, cdx files
7. Load from an image of the structure – gif, png, jpg, tiff – to get an editable/correctable structure for search

Convert an identifier to search ChemSpider





8. Convert an identifier or name to a structure, to use or amend in the structure search

Advanced search options in ChemSpider








9. Search for compound with/without a particular element or elements
10. Search by properties – molecular formula, mol wt, nominal mass, average mass, monoisotopic mass. Exact match or within a range
11. Search by calculated properties range – ACD/LogP, ACD/LogD (pH 5.5), ACD/LogD (pH 7.4), Rule Of 5, Number of Hydrogen Bond Acceptors, Number of Hydrogen Bond Donors, Number of Freely Rotatable Bonds, Polar Surface Area, Polar Surface Area, Molar Volume, Refractive Index, Boiling Point, Flash Point, Density, Surface Tension
12. Search by data sources – select one or many individual data sources (from the 400 we hold), one or many data source types from Available Chemicals Databases, Biological Properties , Chemical Reactions, Chemical Safety Data , Drugs or Compounds in Development, Imaging Agents , Information Aggregators, Journal Publishers via MeSH , Ligand/binding/crystal Structure Databases, Metabolic Pathways , Molecular Libraries Screening Center Network, Natural Products, NIH Substance Repository, Patents, Personal Collections, Physical Properties (including SAR/QSAR databases), Protein 3D Structures, Publication or Magazine Article, Spectroscopy Databases , Substance Vendors, Theoretical Properties, Toxicology/Environmental Databases, Virtual Library, Web-based Article (blog or commentary)
13. Search by focussed library – Building Blocks, Screening Compounds, Building Stock, D-EXP014, Acetylcholinesterase (AChE), cAMP dependent protein kinase (PKA), Estrogen Receptor (Alpha), Phospholipase A2 (PLA(2)), Test Set for DILI modelling, Test Set for DILI modelling, Training Set for DILI modelling
14. Search by ligand screening – LASSO (Ligand Activity in Surface Similarity Order) similarity
15. Combine search to look for Single- or multi-component structures
16. Combine search to look for, or disregard, isotopically labelled structures
17. Filter results with analytical data

ChemSpider APIs



18. Use our web services for mass spectrometry to search by molecular mass or elemental composition within ChemSpider or within particular data sources,
19. Use our web services to search by chemical identifier, retrieve information about ChemSpider record, retrieve the chemical structure thumbnail
20. Use our web services for spectra to return all Open Data spectral information from ChemSpider, return spectral information on a compound, return identified spectra
21. You can show all spectra of a particular type on the spectra page