Hi Erik, It looks to me as though you've set things up correctly. I'd agree with David, see if you can isolate the issue to the REST server or not.
I followed the instructions you included, and the document wrote to the database for me just fine. Hopefully there's just something simple that's been missed. Charles On 02/07/2014 03:09 AM, David Ennis wrote: HI. Have you tried to simulate the write using cUrl form the command line or similar? I suggest this because the Java API is now essentially a convenience wrapper for the REST interface. So taking it back a level and issuing your own REST request under a controlled test may help you isolate the cause and at least verify if the issue is with: 1) Something with your configuration on the MarkLogic side OR 2) An issue with the Java side of your code. Kind Regards, David Ennis On 07/02/14 11:35, Erik van der Hoeven wrote: Hi Geert, I followed the instructions and make a new user named "REST-WRITER". As you see in the picture below: [Inline image 1] with password x [Inline image 2] And try to execute the statment below: [Inline image 3] But still i got the following error: [Inline image 4] Any ideas.. Many thanks.. Met vriendelijke groeten/with kind regards, Erik van der Hoeven Consultant Business Intelligence DIKW CONSULTING BV Einsteinbaan 12 3439 NJ Nieuwegein M: 06-43029943 E: [email protected]<mailto:[email protected]> On Thu, Feb 6, 2014 at 10:08 PM, Geert J. <[email protected]<mailto:[email protected]>> wrote: Hi Erik, So, you used instructions similar to the ones described at below page to create this ‘Administrator’ user inside MarkLogic Admin interface? http://developer.marklogic.com/learn/java/setup#create-rest-users Kind regards, Geert Van: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] Namens Erik van der Hoeven Verzonden: donderdag 6 februari 2014 22:00 Aan: MarkLogic Developer Discussion Onderwerp: Re: [MarkLogic Dev General] Java API error Hi Geert, As i mentioned, i use the Administrator account. The same account which i use for the installation of Marklogic. DatabaseClient client = DatabaseClientFactory.newClient("localhost", 8010,"Administrator", "<PASSWORD>", Authentication.DIGEST); // Make a document manager to work with text files. TextDocumentManager docMgr = client.newTextDocumentManager(); // Define a URI value for a document. String docId = "/example/text.txt"; // Create a handle to hold string content. StringHandle handle = new StringHandle(); // Give the handle some content handle.set("A simple text document"); // Write the document to the database with URI from docId // and content from handle docMgr.write(docId, handle); // release the client client.release(); }} Thanks a lot ? Met vriendelijke groet, Erik van der Hoeven Consultant Business Intelligence DIKW CONSULTING BV Einsteinbaan 12 3439 NJ Nieuwegein M: 06-43029943 E: [email protected]<mailto:[email protected]> Op 6 feb. 2014 21:39 schreef "Geert J." <[email protected]<mailto:[email protected]>>: Hi Erik, Can you provide a bit more details about which example, and how you executed it? The error sounds like you provided invalid credentials. You need to provide valid credentials for a user you created in MarkLogic. Typo perhaps? The other option is that you are using a user with insufficient privileges, e.g. needs more roles. But I’d expect a different message for that.. Kind regards, Geert Van: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] Namens Erik van der Hoeven Verzonden: donderdag 6 februari 2014 21:31 Aan: [email protected]<mailto:[email protected]> Onderwerp: [MarkLogic Dev General] Java API error Gentlemen, When i tried to execute the example of Marklogic JAVA API. Whith my administrator account. I have installed the complete lib directory of the Marklogic JAVA API. But now i get the following error: Exception in thread "main" com.marklogic.client.FailedRequestException: Local message: write failed: Unauthorized. Server Message: Unauthorized at com.marklogic.client.impl.JerseyServices.putPostDocumentImpl(JerseyServices.java:1093) at com.marklogic.client.impl.JerseyServices.putDocument(JerseyServices.java:904) at com.marklogic.client.impl.DocumentManagerImpl.write(DocumentManagerImpl.java:345) at com.marklogic.client.impl.DocumentManagerImpl.write(DocumentManagerImpl.java:280) at com.marklogic.client.impl.DocumentManagerImpl.write(DocumentManagerImpl.java:240) at tweetapi.DBClient.main(DBClient.java:41) Java Result: 1 I hope you can help me out Met vriendelijke groeten, Erik van der Hoeven Consultant Business Intelligence DIKW CONSULTING BV Einsteinbaan 12 3439 NJ Nieuwegein M: 06-43029943 E: [email protected]<mailto:[email protected]> _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://developer.marklogic.com/mailman/listinfo/general -- David Ennis Content Engineer [HintTech Mastering the value of content]<http://www.hinttech.com> Mastering the value of content creative | technology | content Delftechpark 37i 2628 XJ Delft The Netherlands T: +31 88 268 25 00 M: +31 6 000 000 00 [Website]<http://www.hinttech.com> [Twitter] <https://twitter.com/HintTech> [Facebook] <http://www.facebook.com/HintTech> [LinkedIn] <http://www.linkedin.com/company/HintTech> [HintTech Mastering the value of content]<http://www.dayon.nl> -- Charles Greer Senior Engineer MarkLogic Corporation [email protected]<mailto:[email protected]> Phone: +1 707 408 3277 www.marklogic.com<http://www.marklogic.com>
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
