Hi Ben,
We have various JUnit tests for checking the correctness of our client API [1], so my guess is that the server protocol works correctly here. However, it may be due to your specific input file that an error is raised. Could you possibly try the Java client and see if it works with your XML document, or forward me the file in question?
Best, Christian
[1] https://github.com/BaseXdb/basex/blob/master/basex-core/src/test/java/org/ba...
On Tue, Apr 24, 2018 at 2:36 PM, Ben Engbers Ben.Engbers@be-logical.nl wrote:
Hi Christian,
I changed my code to: add = function(path = path, input = input) { writeBin(as.raw(0x09), private$sock) writeBin(private$raw_terminated_string(path), private$sock) writeBin(private$raw_terminated_string(input), private$sock) private$info <- self$str_receive() return(list(info = private$info, success = self$bool_test_sock())) } and tested the new code with: Path1 <- "Test1.xml" Path2 <- "test/Test1.xml" Simple1 <- "<x>Hello World!</x>" Simple2 <- "/home/bengbers/DataScience/RBaseX/Test1.xml" Simple3 <- "Test1.xml" Added <- Session$add(path = Path1, input = Simple1)
(Simple2 is Simple1 written to Test1.xml
When used with either Path1 or Path 2, Added$info returns: "Improper use? Potential bug? Your feedback is welcome:\nContact: basex-talk@mailman.uni-konstanz.de\nVersion: BaseX 9.0\nJava: Oracle Corporation, 1.8.0_162\nOS: Linux, amd64\nStack Trace: \njava.lang.RuntimeException: Learn: lock file does not exist.\n\tat org.basex.util.Util.notExpected(Util.java:61)\n\tat org.basex.data.DiskData.finishUpdate(DiskData.java:246)\n\tat org.basex.core.cmd.ACreate.update(ACreate.java:97)\n\tat org.basex.core.cmd.Add.run(Add.java:56)\n\tat org.basex.core.Command.run(Command.java:257)\n\tat org.basex.core.Command.execute(Command.java:93)\n\tat org.basex.core.Command.execute(Command.java:116)\n\tat org.basex.server.ClientListener.execute(ClientListener.java:343)\n\tat org.basex.server.ClientListener.add(ClientListener.java:314)\n\tat org.basex.server.ClientListener.run(ClientListener.java:96)\n"
With Path1/Simple2 or Path1/Simple3: ""Test1.xml.xml" (Line 1): Content is not allowed in prolog."
With Path2/Simple2 or Path2/Simple3: ""test/Test1.xml.xml" (Line 1): Content is not allowed in prolog."
In all cases Added$success returns FALSE
In an old mail someone suggested that maybe this was caused by the used encoding. I converted the encoding for Test1.xml from US-ASCII to UTF-8 but this had no effect.
Cheers, Ben
Op 24-04-18 om 13:46 schreef Christian Grün:
Hi Ben,
I assume that this part of the server protocol is indeed outdated. I have just checked out our Java client, which only sends the target path to the server (which includes the name of the document) [1].
Could you check out if this solves the problem? If yes, I’ll be happy to update our documentation.
Best, Christian