Hello,
I would like to know best practices for using RESTXQ for pure XML Web services, in my case AtomPub. First I was surprised that using "rest:produces" in the following line did not produces the specified media-type. But instead "application/xml"
%rest:produces("application/atomsvc+xml")
What was necessary was to use 'output:media-type("application/atomsvc+xml")' in addition. Why that?
Here is the working annotation and code I am talking about:
declare %rest:path("/service") %rest:GET %rest:produces("application/atomsvc+xml") %output:method("xml") %output:omit-xml-declaration("no") %output:media-type("application/atomsvc+xml") function page:service() { <service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom"> <workspace> </workspace> </service> };
I would like to know if I should not use the namespace "page" in order to generate my responses knowing that I will produce only XML responses. Is it appropriate for XML services? Would it be better to create a namespace or a XQuery module in order not to repeat myself in the many annotations I will have to create?
I would not know where to start in order to use RESTXQ with my own module or namespace. Any suggestions are welcome. Thanks,
- Philippe