From: Joe W. <jo...@gm...> - 2012-08-22 14:47:49
|
Hi Adam, Superb work! I'm really looking forward to being able to use this! > The first two items on this page have demo code zips linked under them > that you can download - http://www.adamretter.org.uk/presentations.xml Working from the wheel.xqm example in the XML Prague demo code zip (http://www.adamretter.org.uk/presentations/restful-xquery_xml-prague_20120112_code.zip), I'm having trouble getting my URL right to work with the paths defined in restful-wheel.xqm. Can you advise? Here's what I've done: I've put the wheels module and data in /db/wheels, so inside /db/wheels/, I have restful-wheel.xqm (from the "RESTful XQuery demos" folder) and the round.xml and square.xml files (from the "eXist-db wheel/wheels" folder). I also confirmed that the RESTXQ collection.xconf appeared on its own in /db/system/config/db/. Also, rest:get-resource-functions() returns the following in eXide, making me confident that the trigger has located the module with the RESTXQ annotations: <rest:resource-functions xmlns:rest="http://exquery.org/ns/rest/annotation/"> <rest:resource-function xquery-location="/db/wheels/restful-wheel.xqm"> <rest:identity namespace="http://wheelfactory.com" local-name="create-wheel" arity="1"/> </rest:resource-function> <rest:resource-function xquery-location="/db/wheels/restful-wheel.xqm"> <rest:identity namespace="http://wheelfactory.com" local-name="retrieve-wheel" arity="1"/> </rest:resource-function> <rest:resource-function xquery-location="/db/wheels/restful-wheel.xqm"> <rest:identity namespace="http://wheelfactory.com" local-name="store-wheel" arity="2"/> </rest:resource-function> <rest:resource-function xquery-location="/db/wheels/restful-wheel.xqm"> <rest:identity namespace="http://wheelfactory.com" local-name="inventory" arity="0"/> </rest:resource-function> </rest:resource-functions> I'm trying to get the wheel:inventory() function to return, by calling a URL that matches its path in the annotation: %rest:path("/factory/warehouse/wheel") I first tried the following URL, since the wheel.xqm is in the /db/wheels collection, and /db/... paths are requested at /exist/apps/... http://localhost:8080/exist/apps/wheels/factory/warehouse/wheel This returned: 404: Problem accessing /exist/apps/wheels/factory/warehouse/wheel. Reason: Document /db/wheels/factory/warehouse/wheel not found Then, thinking that perhaps the path is simply relative to eXist's context URL, I tried: http://localhost:8080/exist/factory/warehouse/wheel This returned a slightly different error: 404: Problem accessing /exist/factory/warehouse/wheel. Reason: Not Found I also confirmed in eXide that collection("/db/wheels")/wheel -- the XPath called in wheel:inventory() -- returns the data from the wheels directory. So I'm not sure what's wrong. I see the draft spec says that the URI in %rest:path "is considered relative to a base URI which is implementation defined." (http://exquery.github.com/exquery/exquery-restxq-specification/restxq-1.0-specification.html#path-annotation) My question is: What is the eXist-implementation-defined base URI for RESTXQ? In other words, what URL are the %rest:path values relative to? Can you post a URL that *should* work with a stock installation of eXist? Thanks, Joe p.s. I'm working with eXist 2.1-dev rev. 16979. |