- Enable the optional httpclient module in conf.xml ... look for optional modules , search for httpclient .. you will notice that the are by default disabled. You just need to pull the necessary tags out of the comment lines.
<module class="org.exist.xquery.modules.httpclient.HTTPClientModule" uri="http://exist-db.org/xquery/httpclient" /> - Declare namespace like this:
declare namespace httpclient="http://exist-db.org/xquery/httpclient";
- Call your service like this:
let $stuff-from-post:=httpclient:post(xs:anyURI ("http://ptx-lab:8080/exist/rest//db/proptax/crv/resources/queries/echo.xq") ,<Hello>Arun</Hello>,false(),<Headers/>)Here I am calling a remote eXist xquery exposed as a RESTful service.
- While the above does a HTTP Post, the snippet below is for HTTP GET
let $stuff-from-get := httpclient:get(xs:anyURI("http://www.google.com"),true(),<Headers/>)
The echo.xq looks like this (assumes a lot...but is ASAP - as simple as possible):
xquery version "1.0";
declare namespace xmldb="http://exist-db.org/xquery/xmldb";
declare namespace util="http://exist-db.org/xquery/util";
declare namespace request="http://exist-db.org/xquery/request";
declare option exist:serialize "method=xml media-type=text/xml indent=yes omit-xml-declaration=no";
let $data := request:get-data()
return
<Data>
{$data}
</Data>
Comments (1)
Jan 16, 2010
Anonymous says:
Thank you very much for the imazing data associated with this post. But to deter...Thank you very much for the imazing data associated with this post. But to determine the really good <a href="http://www.bestwritingservice.com">essay writing service</a> students have to know someth. about <a href="http://bestwritingservice.com/essay-order.html">essay order</a>.
Add Comment