basex client implementation
Friday, 4 November 2022 · 5 messages · last reply 6 Nov 2022
EP
Erik Peterson4 Nov 2022 02:38 #
The CLI basexclient uses the same client api as other clients found here yes? https://docs.basex.org/wiki/Clients
from basexclient CLI
Quoted text · 1 line
>BINARY GET lib/example.jpg
as expected, returns the jpg I PUT from there from my client app. However, the same command BINARY GET from my client app, using
COMMAND {command} {result} {info} \00
does not return the jpg. The bytes going to the basex server, at least the command 'BINARY GET lib/example.jpg' part are identical in both cases.
MH
Martin Honnen4 Nov 2022 10:27 #
Quoted text · Erik Peterson · 13 lines
Am 11/4/2022 um 1:38 AM schrieb Erik Peterson: > The CLI basexclient uses the same client api as other clients found > here yes? https://docs.basex.org/wiki/Clients > > from basexclient CLI > >BINARY GET lib/example.jpg > as expected, returns the jpg I PUT from there from my client app. > However, the same command BINARY GET from my client app, using > COMMAND |{command}| |{result} {info} \00| > > does not return the jpg. The bytes going to the basex server, at > least the command 'BINARY GET lib/example.jpg' part are identical in > both cases.
Which client API exactly do you use, which result or error do you get?
There is a Java sample for a binary resource online at
https://github.com/BaseXdb/basex/blob/10.3/basex-examples/src/main/java/org/basex/examples/api/BinaryExample.java (confusingly it uses retrieve instead of BINARY GET).
MH
Martin Honnen4 Nov 2022 11:55 #
Quoted text · Martin Honnen · 23 lines
Am 11/4/2022 um 10:27 AM schrieb Martin Honnen: > > > Am 11/4/2022 um 1:38 AM schrieb Erik Peterson: >> The CLI basexclient uses the same client api as other clients found >> here yes? https://docs.basex.org/wiki/Clients >> >> from basexclient CLI >> >BINARY GET lib/example.jpg >> as expected, returns the jpg I PUT from there from my client app. >> However, the same command BINARY GET from my client app, using >> COMMAND |{command}| |{result} {info} \00| >> >> does not return the jpg. The bytes going to the basex server, at >> least the command 'BINARY GET lib/example.jpg' part are identical in >> both cases. > > Which client API exactly do you use, which result or error do you get? > > There is a Java sample for a binary resource online at > https://github.com/BaseXdb/basex/blob/10.3/basex-examples/src/main/java/org/basex/examples/api/BinaryExample.java > (confusingly it uses retrieve instead of BINARY GET). >
I have tested that the example works with BaseX 103 if "retrieve" is replaced by "BINARY GET".
So it seems
https://github.com/BaseXdb/basex/blob/10.3/basex-examples/src/main/java/org/basex/examples/api/BaseXClient.java needs to be updated/patched.
EP
Erik Peterson4 Nov 2022 18:23 #
Martin,
Thank you! The code ref was helpful to see how transfer and parsing happens server and client side. Bytes are read and handled (escape, valid, term) one at a time. I was trying to read all the data from the server, decode/de-0xFF and then put in a buffer for parsing. Bzzzt...the escape info is needed for parsing. I guess I could parse the escaped data the decode but I'm only burning memory doing it that way.
Best,
Erik
Quoted text · Martin Honnen · 31 lines
On Fri, Nov 4, 2022 at 6:55 AM Martin Honnen <martin.honnen at gmx.de> wrote: > > Am 11/4/2022 um 10:27 AM schrieb Martin Honnen: > > > Am 11/4/2022 um 1:38 AM schrieb Erik Peterson: > > The CLI basexclient uses the same client api as other clients found here > yes? https://docs.basex.org/wiki/Clients > > from basexclient CLI > >BINARY GET lib/example.jpg > as expected, returns the jpg I PUT from there from my client app. However, > the same command BINARY GET from my client app, using > COMMAND {command} {result} {info} \00 > does not return the jpg. The bytes going to the basex server, at least > the command 'BINARY GET lib/example.jpg' part are identical in both cases. > > Which client API exactly do you use, which result or error do you get? > > There is a Java sample for a binary resource online at > https://github.com/BaseXdb/basex/blob/10.3/basex-examples/src/main/java/org/basex/examples/api/BinaryExample.java > (confusingly it uses retrieve instead of BINARY GET). > > I have tested that the example works with BaseX 103 if "retrieve" is > replaced by "BINARY GET". > > So it seems > https://github.com/BaseXdb/basex/blob/10.3/basex-examples/src/main/java/org/basex/examples/api/BaseXClient.java > needs to be updated/patched. >
CG
Thanks for the hint, Martin, I’ve updated the example.
Quoted text · Martin Honnen · 31 lines
On Fri, Nov 4, 2022 at 11:55 AM Martin Honnen <martin.honnen at gmx.de> wrote: > > Am 11/4/2022 um 10:27 AM schrieb Martin Honnen: > > > Am 11/4/2022 um 1:38 AM schrieb Erik Peterson: > > The CLI basexclient uses the same client api as other clients found here > yes? https://docs.basex.org/wiki/Clients > > from basexclient CLI > >BINARY GET lib/example.jpg > as expected, returns the jpg I PUT from there from my client app. However, > the same command BINARY GET from my client app, using > COMMAND {command} {result} {info} \00 > does not return the jpg. The bytes going to the basex server, at least > the command 'BINARY GET lib/example.jpg' part are identical in both cases. > > Which client API exactly do you use, which result or error do you get? > > There is a Java sample for a binary resource online at > https://github.com/BaseXdb/basex/blob/10.3/basex-examples/src/main/java/org/basex/examples/api/BinaryExample.java > (confusingly it uses retrieve instead of BINARY GET). > > I have tested that the example works with BaseX 103 if "retrieve" is > replaced by "BINARY GET". > > So it seems > https://github.com/BaseXdb/basex/blob/10.3/basex-examples/src/main/java/org/basex/examples/api/BaseXClient.java > needs to be updated/patched. >
Written for BaseX 10.3. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery