Forum Discussion
kondasamy
8 years agoRegular Contributor
Hello cghanapu,
You should be able to connect to your Marklogic database through Marklogic Java client. Here are some documents where you can start with,
Marklogic Java client - https://github.com/marklogic/java-client-api (Place the Jar under {%SoapUI Install dir%}/bin/ext)
Documentation - https://developer.marklogic.com/try/java/index
Sample code:
import com.marklogic.client.DatabaseClient
import com.marklogic.client.DatabaseClientFactory
import com.marklogic.client.document.JSONDocumentManager
import com.marklogic.client.io.StringHandle
// Initiate Marklogic connection
client = DatabaseClientFactory.newClient("localhost", 8003, "username", "password",Authentication.DIGEST)
docMgr = client.newJSONDocumentManager()
// Read/ Write operation
doc = docMgr.read("/afternoon-drink", new StringHandle()).get()
docMgr.write("/afternoon-drink", new StringHandle("{name: \"Iced Mocha\", size: \"Grandé\", tasty: true}"))
Please alter the data in the above code according to your need.
Thanks,
Kondasamy