Hi,
Am 30.12.2010 13:59, schrieb software developer:
Well, then the problem changes to 'how to pass dynamic parameters from an HTTP client to the java class in question - java class is running on a different machine' - that bridge was to be the HTTP request parameters
- what else can serve to pass dynamic parameters to the xquery? I
invoke BaseX via jax-rx and xquery is stored on server-side (cannot put that in the URL itself) - xquery is invoked using run param to jax-rx invocation.
Your solution has xquery passing the param to the java class, in my case an external HTTP client is to send the parameters...so, how would the java class receive the HTTP request param or alternatively, how would the xquery receive request param directly via jax-rx?
Currently you can bind values to external variables via JAX-RX (at least in BaseX), using the 'var' parameter.
Assuming your query is
declare variable $x as xs:integer external; declare variable $y as xs:integer external; $x * $y
then the easiest way is to append the parameter
&var=$x=21%01$y=2
to your JAX-RX URI, thus binding 21 to $x and 2 to $y.
Note that you have to glue multiple bindings together with the 'SOH' ASCII char, '\1' in Java and %01 in the URL encoding.
[1] is a working example.
If you also want to specify the type of the bound value, this can be done by appending it to the binding, separated by another '=':
&var=$x=14=xs:integer%01$y=3=xs:integer
See [2] for an example.
Please be aware that the syntax might change with any new minor version in the future.
I hope this helps, Cheers Leo __________
[1] http://localhost:8984/basex/jax-rx?wrap=no&query=declare+variable+$x+as+...
[2] http://localhost:8984/basex/jax-rx?wrap=no&query=declare+variable+$x+ext...