Is there a WebService call to get a mol's structure?

User cec0f3a823

16-05-2009 19:07:03

I looked thru the Web Services API and did not see a call that'd give me a molecule's structure in jpeg, png, etc...


I tried MolConverterWS but that does not seem to like 'png' or 'jpeg' as outputFormat.


I also noticed that the AJAX sample uses a jsp backend script to get a mol's jpeg. Is that the only option at this point?


TIA


julio

ChemAxon e274e1bada

18-05-2009 18:23:27

Hi Julio,


The MolConverterWs can support the same file formats as ChemAxon's MolConverter API. See the manual: http://www.chemaxon.com/jchem/marvin/help/applications/molconvert.html


Please send us an error message and a stack trace if this service cannot work in your system.


Please also specify the your Web Service Server version and the source molecule.


Regards, Edvard

User cec0f3a823

18-05-2009 20:16:25

That's what I thought but it seems MolConvertWS has issues with graphic (binary) outputFormats.


I'm using JChem 5.2.1_1, and getVersionInfo gives me:


<Info> <JChem> <Version>5.2.1_1</Version> </JChem> <Java> <Vendor>Sun Microsystems Inc.</Vendor> <VmName>Java HotSpot(TM) Client VM</VmName> <Version>1.6.0_13</Version> </Java> <Os> <Arch>x86</Arch> <Name>Windows 2003</Name> <Version>5.2</Version> </Os> </Info>


 


When I try this call with MolConvertWS:



<convert xmlns="http://webservice.jchem.chemaxon class="TOD_closeAttrQuote">">
-<targetStructure xsi:type="xsd:string">CCNC(O)=O</targetStructure>

-<outputFormat xsi:type="xsd:string">png</outputFormat>

</convert>



I get this response:


<ns:convertResponse xmlns:ns="http://webservice.jchem.chemaxon class="TOD_closeAttrQuote">">
-<ns:return>‰PNG
-<soapenv:Envelopexmlns:ns="http://webservice.jchem.chemaxon class="TOD_closeAttrQuote">"xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ class="TOD_closeAttrQuote">">
-<soapenv:Body>
-<soapenv:Fault xmlns:ns="http://webservice.jchem.chemaxon class="TOD_closeAttrQuote">">
-<faultcode>soapenv:Server</faultcode>

-<faultstring>Invalid white space character (0x1a) in text to output</faultstring>

-<detail></detail>

</soapenv:Fault>

</soapenv:Body>

</soapenv:Envelope>

</ns:return>

</ns:convertResponse>






I seems to produce the .png fine internally but fails to send it as 'text', thus the invalid character error.


I tried to base64 encode the output using the following call:


<convert xmlns="http://webservice.jchem.chemaxon class="TOD_closeAttrQuote">">
-<targetStructure xsi:type="xsd:string">CCNC(O)=O</targetStructure>

-<outputFormat xsi:type="xsd:string">base64:png</outputFormat>

</convert>




That gave me another error:


<soapenv:Fault>
-<faultcode>soapenv:Server</faultcode>

-<faultstring>Exception occurred while trying to invoke service method convert</faultstring>

-<detail></detail>

</soapenv:Fault>





I have no  problems with text output, MolConvert works file. It seems to have issues with binary output. AFAIK if calling MolConvert from java one needs to use another call to output binary format data. That might be the issue...



Thanks for any help there.


cheers,

julio






User c1ce6b3d19

20-05-2009 16:47:50

Julio,


Yes, I see these types of errors in our local testing. I'm guessing the response (binary) format creates errors and we will need to encode or attach the response.


We are investigating the problem and we will respond soon.


Jonathan Lee


 

User c1ce6b3d19

22-06-2009 12:37:18

Julio,


 


There are two issues here.


1.  The format parameter "png" failed because the image formats (jpeg, png, emf, msbmp, ppm) are in binary.  To pass these through Web Services, they will be automatically converted using base64 encoding to a "text" friendly format.  These will need to be decoded on the client side. 


2.  The format parameter "base64:png" failed due to a bug in the mol conversion tool.   This output will also need to be decoded on the client side.


Both bugs are fixed in the version 5.2.3. It will be available at the beginning of july.


Cheers, Jon