Forum Discussion

cghanapu's avatar
New Contributor
6 years ago

MarkLogic DB connection

I am using SOAPUI open source. Can some one help me connecting to MarkLogic DB usin groovy scripting ? Much appreciated.

1 Reply

  • kondasamy's avatar
    Regular 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 - (Place the Jar under {%SoapUI Install dir%}/bin/ext)

    Documentation -


    Sample code:

    import com.marklogic.client.DatabaseClient
    import com.marklogic.client.DatabaseClientFactory
    import com.marklogic.client.document.JSONDocumentManager
    // Initiate Marklogic connection
    client = DatabaseClientFactory.newClient("localhost", 8003, "username", "password",Authentication.DIGEST)
    docMgr = client.newJSONDocumentManager()
    // Read/ Write operation
    doc ="/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.