MarvinSketch Image Generation using javascript

User 21178756d4

11-11-2011 05:52:47

Hi There,


  I am working with marvinsketch and everything goes well but in the end there is one problem i am facing. I want to generate image of designed chemical structure through javascript in asp.net . Is there any webservices for creating images which takes some parameters like smile code and return the image or path .


 


Or Is there any example in c# like


<html>


<body>


<img
src="http://server:8080//generate_image.jsp?mol=<%=Server.URLEncode(request.querystring("s"))%>&format=<%=Server.URLEncode("jpeg:h"
+ request.querystring("h") + ",#ffffff")%>" />


</body>


</html>


 


Please Help Me out.


Thanks & Regards


Kumar.

ChemAxon 5433b8e56b

27-11-2011 21:43:03

Hi Kumar,


sorry for the very late answer.


To generate an image from a molecule source on the server side, you can try two things, one is to create an image service url with the help of the MarvinBeans libraries or the molconvert application on the server side. In this case you have to have some server side script that serves the image for a structure comes in a query. This is what the image-generation.jps example shows you. To create such a server side element you can choose anything that can call an application, but you could reach better performance if you use a java web server conatiner, and write a small servlet that loads MarvinBeans library once, not attemt to start a java virtual machine for every request to run a java application that does the conversion.


In this page you can find detailed information on how to setup a tomcat web container, with the image generation code that is icluded in the examples folder of your MarvinBeans installation library.


You may be able to use the .Net version of the MarvinBeans API in an asp.net environment on the server side also, and based on the java source code, you can create an asp.net replacement, but currently as far as i know we do not have a complete .net example on this.


The other way is to install the Chemaxon Web Services onto a server, and use the MolConvertWS web service. In this case you may encounter problems because in this case the converted image travels as a string in a web service envelope, and this conversion may not work.


Regards,
Istvan