[R] SSOAP & chemspider

Benton, Paul hpaul.benton08 at imperial.ac.uk
Wed Jul 20 02:54:23 CEST 2011


Dear all,

I've been trying on and off for the past few months to get SSOAP to work with chemspider. First I tried the WSDL file:

cs<-processWSDL("http://www.chemspider.com/MassSpecAPI.asmx?WSDL")
Error in parse(text = paste(txt, collapse = "\n")) : 
  <text>:1:29: unexpected input
1: function(x, ..., obj = new( ‚
                               ^
In addition: Warning message:
In processWSDL("http://www.chemspider.com/MassSpecAPI.asmx?WSDL") :
  Ignoring additional <service><port> ... elements

Next I've tried using just the pure .SOAP to call the database. 

s <- SOAPServer("http://www.chemspider.com/MassSpecAPI.asmx")
csid<- .SOAP(s, "SearchByMass2", mass=89.04767, range=0.01,
        action = I("http://www.chemspider.com/SearchByMass2"),
        xmlns = c("http://www.chemspider.com"), .opts = list(verbose = TRUE))

This seems to work and gives back a result. However, this result isn't the right result. It's seems to have converted the mass into 0. When I run the similar program in perl I get the correct id's. So this isn't a server side problem but SSOAP. Any thoughts or suggestions on other packages to use?
Further infomation about the SeachByMass2 method and it's xml that it's expecting.
http://www.chemspider.com/MassSpecAPI.asmx?op=SearchByMass2

Cheers,


Paul


PS Placing a fake error in the .SOAP code I can look at the xml it's sending to the server:
Browse[1]> doc
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body>
    <ns:SearchByMass2 xmlns:ns="http://www.chemspider.com">
      <ns:mass>89.04767</ns:mass>
      <ns:range>0.01</ns:range>
    </ns:SearchByMass2>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


More information about the R-help mailing list