通过API

时间:2015-10-31 10:17:06

标签: java linux

下面的chemaxon片段我试图在linux终端上运行它,但是我失败了。任何人都可以告诉我如何从linux.Thanks中的chemaxon(https://docs.chemaxon.com/display/marvinsketch/HTTP)运行以下脚本。

HTTPServiceDescriptor descriptor = new HTTPServiceDescriptor();
descriptor.setURL("http://chemicalize.org/tomcat-files/datapage.jsp");

descriptor.addArgument(ServiceArgument.createArgument("mol", ""));
descriptor.addArgument(ServiceArgument.createArgument("special", ""));
descriptor.addArgument(ServiceArgument.createArgument("pka_width", 0));

Object result = null;
try {
    result = descriptor.getServiceHandler().callService(descriptor, "c1ccnccc1", "pka", 300);
} catch (ServiceException e) {
   System.err.println("Service call failed.");
}
System.out.println("Synchronized call returned: " + String.valueOf(result));


descriptor.getServiceHandler().callService(descriptor, new AsyncCallback<String>() {

    @Override
    public void onSuccess(String result) {
        System.out.println("Aynchronous call returned: " + result);
    }

    @Override
    public void onFailure(ServiceException caught) {
        System.err.println("Asynchronous call failed.");
    }

}, "c1ccnccc1", "pka", 300);

0 个答案:

没有答案