[xquery-talk] XQuery web APIs

Martin Probst martin at x-hive.com
Tue May 16 23:25:46 PDT 2006


Hi,

your "simple" example is pretty much what I have in mind.

> Qexo provides a functional way of setting the response-header:
> http://www.gnu.org/software/kawa/HTTP-response.html
> (The manual emphasises the Scheme language rather the XQuery,
> but there functions are also available.)
> Basically the "response-header" is pre-pended to the data.

This looks like what eXist an MarkLogic do - does response-header 
(..., ...) actually return a value in XQuery or does it have a side  
effect? And if it returns a value, how does that look? Do you use XML  
or rather have a "magic" value?

In my local changes I currently use external variables to pass in  
parameters from the web request, I get the list of declared external  
variables from the query, and bind each one to a request parameter if  
the namespace URI is a certain X-Hive URI and the local name matches  
the HTTP request parameter name. Writing
declare variable $web:req external;
seemed somewhat more natural to me than
web:get-request-param("req")
though the default values have some appeal.

I think the minimal feature set of an XQuery web API would be
- Set arbitrary response headers
- Set HTTP response code and message
- Get request parameters
- Get request path
- Get request method (?)

Additionally, requesting other stuff of the web might be nice, though  
a little bit more complex.

Regards,
Martin

-- 
Martin Probst
X-Hive Corporation
martin at x-hive.com





More information about the talk mailing list