Wiki source for ExistInvoke


Show raw source

======eXist Command: invoke======
invokes a stored query on an eXist server

====Synopsis====
invoke [exist options] [options] query-uri

====Description====
Invokes a stored query residing on an eXist server. In order for a resource to be used with invoke it must be stored with the Content-Type of "application/xquery".


====Options====
The invoke command accepts all [[ExistCommonOptions eXist Common Options]]

||-d,-data file||Supplies the contents of "file" as the input data to the stored query||
||-raw||Outputs the results without any parsing. Supplying -d assumes -raw||


If -d or -data is specified then the file (or standard input if "-") is supplied to the query. Otherwise no data is supplied to the query.

====Example====
Assuming the prefix "e" is imported as the exist, invokes the stored procedure "run.xquery"


%%
e:invoke run.xquery
%%

For example storing the query "1 to 5,'hi',<elem/>" then invoking it.

%%
echo "1 to 5,'hi',<elem/>" | e:put -uri /db/test/run.xquery -contentType application/xquery
e:invoke /db/test/run.xquery
%%

Result
%%
1
2
3
4
5
hi
<elem/>
%%



====Implementation====

invoke is implemented using the REST protocol using the GET and POST methods.
When no -data argument is supplied then GET is used and the result is wrapped by eXist into a structure which is parsed as XDM values (unless -raw is specified).
When a -data argument is supplied then POST is used and the resulting data is returned in the raw as text.

See [[http://exist.sourceforge.net/devguide_rest.html]]

----
[[ModuleExist eXist Extension Module]]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki