Created
May 9, 2009 16:21
-
-
Save edrin/109331 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//****************************************************** | |
//* Script to calculate the mass of a chemical structure | |
//****************************************************** | |
//Connect if not connected (requires JID and password in preferences) | |
if (!(xmpp.isConnected())) | |
xmpp.connect(); | |
//Get service and function from xmpp network | |
var service = xmpp.getService("cdk.ws1.bmc.uu.se"); | |
var func = service.getFunction("calculateMass"); | |
//Get schema from service | |
var iof; | |
if (xmpp.existsIoFactory(func)) //Check if binding exists | |
iof = xmpp.getIoFactory(func); //Try to load generated binding | |
if (iof==null) { | |
var ios = func.getIoSchemataSync(90000); //Get schema from service | |
iof = xmpp.getIoFactory(ios); //Generate binding | |
} | |
//Set up input and invoke service | |
var smiDoc = iof.createSmilesDocument(); | |
smiDoc.setSmiles("CCC(CC)CCNCCO"); | |
var result = func.invokeSync(smiDoc.toString(), 900000); | |
//Get results and print to console | |
var obj = iof.getOutputObject(result); | |
js.print("\n\nMass of molecule: "+ obj.getStringValue()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment