setting up Webservices

User 870ab5b546

07-11-2013 17:27:39

Hello,


My colleague has correctly installed the WAR file.  We can direct our browser to /webservices/jaxrs and see the information page.  But so far I am unable to connect Marvin4JS to the Webservices.  My web page containing MarvinrJS is in /public/, and editorws.html is in /nosession/marvin4JS/.  I altered webservices.js so that getDefaultServicesPrefix() returns '../../webservices'.  When I draw a structure with a stereocenter and I press the R/S button, I see this console error:


[marvin UnchaughtException]:Class$S1105: empty argument

referring to editorws.html:524. 


When I press the Clean2D button, Marvin4JS gives me this error message:


Cannot parse the clean result:

Failed to parse: error on line 1 at column 1: Extra content at the end of the document

???


-- Bob

ChemAxon 7c2d26e5cf

13-11-2013 17:49:43

I assume it is a webservice configuration issue.


Please, test the webservice with the same parameter.


Visit to the landing page of your running webservice (e.g.: https://www.mydomain.com/webservices/).


Browse on this page to the Cip Stereo Info section (#cipStereoInfo).


You will find an input form with input values. Submit the form.


The result of the service is displaying in the text box below the input form.


If the service does not work via Marvin4JS, it should also fail when you try it directly from the webservice landing page.


In the configuration issues of the webservice, the JChem Webservice team can give further support.

User 870ab5b546

13-11-2013 18:23:45

When I load the page, I see the screen shot below.  Nothing changes when I press the Post button. 


I don't understand what this is supposed to signify.


If this helps, I see these errors in the browser's console when the page is loaded:


[Error] Failed to load resource: the server responded with a status of 500 (Internal Server Error) (scripts.js, line 0)
[Error] Failed to load resource: the server responded with a status of 500 (Internal Server Error) (style.css, line 0)
[Error] Failed to load resource: the server responded with a status of 500 (Internal Server Error) (ace.js, line 0)
[Error] Failed to load resource: the server responded with a status of 500 (Internal Server Error) (jquery-1.8.2.min.js, line 0)
[Error] ReferenceError: Can't find variable: $
global code (webservices, line 4128)

ChemAxon 7c2d26e5cf

14-11-2013 09:41:53

It seems that a JChem Webservice issue.


I have assigned this topic to the JChem Webservice team to help you.

ChemAxon e07e2a364b

15-11-2013 16:13:44

The error messages just means that your web server for some reason not serving the requested files. Can you tell us a bit more about the configuration? Do you use tomcat? Can you send us the log files?

User fa1369adab

18-11-2013 15:01:15

To investigate the situation, I have written a Python script that directly invokes the various webservice features; I could never get the script at https:///www.mydomain.com/webservices/ to respond to a POST button.


We are using Tomcat6 as our server.


 


A Python JSON request to util/calculate/cipStereoInfo succeeds; the information returned for cis-1,2-dichlorocyclohexane is


{"headers":{"tetraHedral":{"name":"tetraHedral","type":"COMPLEX","source":"CALCULATOR"},"doubleBond":{"name":"doubleBond","type":"COMPLEX","source":"CALCULATOR"}},"tetraHedral":[{"atomIndex":0,"chirality":"R"},{"atomIndex":1,"chirality":"S"}],"doubleBond":[]}

 


The Tomcat6 log shows:


09:41:53.190 [http-9136-8] INFO  c.j.w.util.RestServiceFilter - 128.163.184.187 remaining quota: 99 (65.69 μs)

09:41:53.191 [postProcessExecutor-3] INFO  c.j.ws2base.mapping.FieldMapperImpl - displayOptions build: 12.91 μs

09:41:53.192 [http-9136-8] INFO  c.j.ws2base.mapping.FieldMapperImpl - 

            sum: 1.306 ms

             cipStereoInfo 184.1 μs 1 OK




09:41:53.192 [http-9136-8] DEBUG c.j.w.util.RestServiceFilter - 2.065 ms - http://epoch.uky.edu:9136/webservices/rest-v0/util/calculate/cipStereoInfo

 


Some other advertised functions also work properly: util/checkers, util/calculate/stringMolExport, util/analyze.  However, the following functions fail, with logged results shown.


util/convert/standardizer (giving aspirin as the structure parameter)


09:47:32.275 [http-9136-8] ERROR c.j.ws2base.util.RestExceptionMapper - null

javax.ws.rs.WebApplicationException: null

        at com.sun.jersey.server.impl.uri.rules.TerminatingRule.accept(TerminatingRule.java:66) ~[jersey-server-1.17.1.jar:1.17.1]

        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) ~[jersey-server-1.17.1.jar:1.17.1]

        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) ~[jersey-server-1.17.1.jar:1.17.1]

        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) ~[jersey-server-1.17.1.jar:1.17.1]

        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511) [jersey-server-1.17.1.jar:1.17.1]

  ...




util/convert/clean (with c1ccccc1 as the structure parameter)


 


09:49:11.958 [http-9136-8] ERROR c.j.ws2base.util.RestExceptionMapper - null

javax.ws.rs.WebApplicationException: null

        at com.sun.jersey.server.impl.uri.rules.TerminatingRule.accept(TerminatingRule.java:66) ~[jersey-server-1.17.1.jar:1.17.1]

        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) ~[jersey-server-1.17.1.jar:1.17.1]

        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) ~[jersey-server-1.17.1.jar:1.17.1]

        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) ~[jersey-server-1.17.1.jar:1.17.1]

        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511) [jersey-server-1.17.1.jar:1.17.1]

  ...

ChemAxon 13811e1703

18-11-2013 15:56:12

Hello,


There are some issues with JChem Web Services and Tomcat6, if its possible please use Tomcat7!

Alternatively you can remove these configurations form the  WEB-INF/web.xml inside the war file:
-2 filter definitions:  continuation, gzip
-1 filter mapping: gzip
(this will disable compression of responses) 


 


Regards,
Peter

User fa1369adab

18-11-2013 20:35:12

I had mis-installed the Marvin for Javascript license, which may have caused some problems.  The errors I report above with JSON/Python still happen.  The current behavior when I use Marvin for Javascript to compute stereo information:


15:26:35.940 [http-9136-3] INFO  c.j.ws2base.mapping.FieldMapperImpl - 

            sum: 1.299 ms

             cipStereoInfo 177.7 μs 1 OK




15:26:35.940 [http-9136-3] DEBUG c.j.w.util.RestServiceFilter - 2.610 ms - http://myDNSname/webservices/rest-v0/util/calculate/cipStereoInfo

15:26:35.942 [http-9136-3] ERROR o.a.c.c.C.[.[.6.[.[jersey-jaxrs] - Servlet.service() for servlet jersey-jaxrs threw exception java.lang.IllegalStateException: !(Jetty || Servlet 3.0 || ContinuationFilter)
        at org.eclipse.jetty.continuation.ContinuationSupport.getContinuation(ContinuationSupport.java:150) ~[jetty-continuation-7.6.8.v20121106.jar:7.6.8.v20121106]

        at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:248) ~[jetty-servlets-7.6.8.v20121106.jar:7.6.8.v20121106]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) ~[catalina-6.0.24.jar:na]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[catalina-6.0.24.jar:na]

        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) ~[catalina-6.0.24.jar:na]


So it looks like the computation is good, but returning the result fails.  We cannot easily upgrade to Tomcat7, although we will if we must.  I have not yet tried your suggestion about modifying the WAR file; I hesitate to do that, because I don't know (yet) how to reassemble a WAR file.  Do you still want me to try that?

ChemAxon e07e2a364b

21-11-2013 14:41:08

WAR files are actually plain zip files containing java classes and resource files. Could you try Peter's suggestion? 

User fa1369adab

21-11-2013 22:48:38

Thanks for the suggestion.  I unzipped webservices.war, commented out the three items mentioned above, rebuilt the war file with 


jar cf webservices.war *

undeployed and redeployed webservices.war.  My simple test shows that the simple test for computing stereo from MarvinSketch for Javascript is now working.  I'll let Bob Grossman test it further.

User 870ab5b546

22-11-2013 04:10:05

Yes, both configuration display and 2D cleaning are working now.  Thanks for all your help.

User 870ab5b546

22-11-2013 04:11:02

Yes, both configuration display and 2D cleaning are working now.  Thanks for all your help.

User d535ec364f

06-01-2014 08:04:10

Nice post for web service.








Windows
service pack Support

ChemAxon f052bdfe3c

10-01-2014 14:38:45

Thank you,


Efi