Skip to main content

Developing with XCC

HelloSecureWorld

This program runs a query on MarkLogic Server that returns the string Hello World, using an SSL/TLS connection to MarkLogic Server.

This example can load a specified key store of trusted signing authorities, use the Java default key store, or use a stub that accepts any server certificate. It can also load client certificates from a specified key store or connect without a certificate.

The server certificate command line parameter may be any of the following:

  • the path to a Java Key Store containing trusted signing authorities

  • DEFAULT - use the Java default cacerts

  • ANY - accept any server certificate

Optionally, you may also specify the path to a Java Key Store containing client certificates, along with its passphrase.

The following is a sample command to run the HelloSecureWorld class, accepting any certificate and no client authentication (the XDBC App Server needs ssl require client certificate set to false for this configuration).

java -classpath "XCC_HOME/lib/xcc.jar:XCC_HOME/lib/xccexamples.jar"
     com.marklogic.xcc.examples.HelloSecureWorld 
     xccs://username:password@localhost:8021 ANY

Note

When FIPS mode is enabled (which is the default), you need to use strong client ciphers, and you need to download and install the Java Cryptography Extension (JCE) Unlimited Strength package.