Marvin JS Web Services

    Marvin JS Web Services is a small, simple web service application embedding Marvin JS and providing tools for transforming, exporting, and converting chemical structures. It contains the latest webjar release of Marvin JS.

    This documentation describes installation, administration and usage of Marvin JS Web Services.

    Software Requirements

    • Windows, Linux, or Mac OS
    • Java 11 (from version 21.19.0) is needed. We support AdoptOpenJDK 11 as well. In the case of AdoptOpenJDK, libfontconfig package must be included.

    Installation

    The operating system dependent mjs-webservice (mjsws) installers (.exe, .sh, .deb, .rpm, .dmg) must be run or the independent installers must be extracted (.zip, .tar.gz).

    Licenses

    Required license: Marvin JS license

    Put the Marvin JS license file under <userhome>/chemaxon/licenses/ (on Windows) or <userhome>/.chemaxon/licenses/ (on Linux) folder or apply any of the options listed in Installing to Servers page.

    Configuration

    Configuration file application.properties is available under the installed mjs-webservice/config/ folder. In application.properties file you can set the followings:

    Option name Default value
    server.port 8080
    logging.file.name ./logs/mjs-webservice.log
    spring.application.name mjs-webservice

    For more settings possibilities, see the spring documentation page.

    Configuring Cross Origin Policy

    By default it is allowed to access the web services from every origin. If you want to limit which JavaScript applications can access the web services, configure the following default values in application.properties accordingly:

    endpoints.cors.allowed-headers=*
    endpoints.cors.allowed-methods=*
    endpoints.cors.allowed-origins=*
    endpoints.cors.max-age=1800

    You can set a list of values by separating the individual values with a comma. For more information, see CORS.

    Forbid CORS

    This setting accepts same-origin requests only.

    endpoints.cors.allowed-headers=
    endpoints.cors.allowed-methods=
    endpoints.cors.allowed-origins=

    Allow CORS on Two Origins

    Enable Cross origin calls from origin1.com and origin2.example.com

    endpoints.cors.allowed-headers=*
    endpoints.cors.allowed-methods=*
    endpoints.cors.allowed-origins=http://origin1.com, http://origin2.example.com
    endpoints.cors.max-age=1800

    Enabling HTTPS

    By default, the REST endpoints use plain HTTP as a transport. You can switch to HTTPS easily, by adding a certificate to your configuration, for example, skipper.yml.

    {info} You can reference the Yaml file using the following parameter: --spring.config.location=skipper.yml

    server:
      port: 8443                                         (1)
      ssl:
        key-alias: yourKeyAlias                          (2)
        key-store: path/to/keystore                      (3)
        key-store-password: yourKeyStorePassword         (4)
        key-password: yourKeyPassword                    (5)
        trust-store: path/to/trust-store                 (6)
        trust-store-password: yourTrustStorePassword     (7)
    1. As the default port is 7577, you may choose to change the port to a more common HTTPS-typical port.
    2. The alias (or name) under which the key is stored in the keystore.
    3. The path to the keystore file. Classpath resources may also be specified, by using the classpath prefix: classpath:path/to/keystore.
    4. The password of the keystore.
    5. The password of the key.
    6. The path to the trust store file. Classpath resources may also be specified, by using the classpath prefix: classpath:path/to/trust-store.
    7. The password of the trust store.

    For more details, see spring configuration-security.

    Running the server

    Start the service application by either running run-mjs-webservice.exe or run-mjs-webservice.sh. The service application (mjs-webservice.exe or mjs-webservice.sh) can also be set as a service, and started or stopped by the operating system. For installing as a service in Windows, run mjs-webservice/mjs-webservice.exe --install.

    Usage

    Open Marvin JS on <serverhost>:<port>. Default: localhost:8080. See below how to work with the provided web service functions.

    Functionalities available on the canvas of Marvin JS

    The red labeled icons below on the top toolbar of Marvin JS serve for executing structure transformations.

    images/download/attachments/1804366/marvinjs_canvas.jpg

    Functionalities available from API

    Click on the WebServices API icon on the right bottom corner of Marvin JS.

    images/download/attachments/1804366/marvinjs_api.jpg

    The opening Marvin JS Web Services page contains API examples and a link to the API documentation.

    images/download/attachments/1804366/marvinjs_api3.jpg
    • calculate-controller
      • cipStereoInfo
      • elementalAnalysis
      • molExport
      • reactionExport
    • convert-controller
      • clean
      • formats
      • hydrogenizer
      • reactionConverter
    • license-controller
      • grant

    Docker Image Example

    We created an example page to help you get started with Marvin JS in a container with its backend services. For more information, see the example page.