I've recently created a simple protocol to calculate molecular weight for a given SMILES string be exposed as a RESTful web service but I'm getting some awkwardness with some special characters coming over HTTP.
I've read the AEP RESTful web services documentation and I think I've included everything I need to make this work but may well have missed something.
My package.conf file looks something like this:
method GET
request /molwt/{+Smiles}
protocol Protocols/Web Services/Restful/MolWt
querystring off
#param __poolid calc-molwt
calculates molecular weight for the passed smiles string
publish True
I call the service by visiting the following url: http://myserver:9944/molwt/CC=C and get the value 42.07974 (all good).
The problem manifests itself when I attempt to use more specialised characters in the SMILES string (e.g. positive charges), for example (tri-nitro toluene): CC1=C(C=C(C=C1[N+](=O)[O-])[N+](=O)[O-])[N+](=O)[O-], which translates to the following SMILES in the protocol: CC1=C(C=C(C=C1[N ](=O)[O-])[N ](=O)[O-])[N ](=O)[O-]
i.e. all +'s are replaced by spaces.
I've tried URL encoding the SMILES string but that made no difference. I've also considered hex encoding the SMILES string but this creates an added layer of complexity for the client, so I'm not keen on this approach.
I'm sure somebody must have come across this before and if so, how did you get around the problem?
Cheers,
Jim
