Dear community,
has anyone managed to get SSOAP working with the ChemSpider Web APIs, using
functions which need the security token?
I use SSOAP 0.9-0 from the OmegaHat repository.
In the example code from SSOAP there is a sample which uses a token function.
Interestingly, it checks if(!is.character(token)) first (and proceeds if the
token is NOT character.) I can't test that function since I have no idea how to
get the token into "non-character" form :)
My code:
library(SSOAP)
chemspider_sectoken <- "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# (token was here)
cs <- processWSDL("http://www.chemspider.com/Search.asmx?WSDL")
# intf <- genSOAPClientInterface(,cs)
# (this fails, see below. The Mass Spec API is correctly parsed. Therefore by
hand:)
csidlist <- .SOAP(server=cs@server,
method="SimpleSearch",
.soapArgs=list(
query="Azithromycin",
token=token
),
action=I("http://www.chemspider.com/SimpleSearch"),
xmlns=c("http://www.chemspider.com/")
)
Fehler: Error occurred in the HTTP request: Unauthorized web service usage.
Please request access to this service. ---> Unauthorized web service usage.
Please request access to this service.
If one looks into the request, the doc seems to be correct:
<?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:SimpleSearch xmlns:ns="http://www.chemspider.com/">
<ns:query xmlns:ns="http://www.chemspider.com/"
xsi:type="xsd:string">Azithromycin</ns:query>
<ns:token xmlns:ns="http://www.chemspider.com/"
xsi:type="xsd:string">xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</ns:token>
</ns:SimpleSearch>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Compared to the sample request from the ChemSpider homepage:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SimpleSearch xmlns="http://www.chemspider.com/">
<query>string</query>
<token>string</token>
</SimpleSearch>
</soap:Body>
</soap:Envelope>
To me, both look like perfectly fine XML and should be identical to the
ChemSpider XML parser. Do I need to write the token in another format? Is
something else wrong? I also tried to use .literal = T to no avail: "Error
occurred in the HTTP request: Empty query"
Best regards,
-Michael
PS: the error message from the genSOAPClientInterface call is:
Note: Method with signature "ClassDefinition#list" chosen for function
"resolve",
target signature "ExtendedClassDefinition#SchemaCollection".
"SOAPType#SchemaCollection" would also be valid
Fehler in makePrototypeFromClassDef(properties, ClassDef, immediate, where) :
'name' muss eine nicht-Null Zeichenkette sein
Zusätzlich: Warnmeldung:
undefined slot classes in definition of "ExactStructureSearchOptions": NA(class
"EMatchType")
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.