From: Peter W. <plw...@bl...> - 2012-10-24 07:28:18
|
Hi I'll try to explain this as clearly as I can. I'm trying to extract data from a database via a RESTful api. This is the code of the xquery that I have used: xquery version "1.0"; declare namespace httpclient="http://exist-db.org/xquery/httpclient"; let $feeds-url := "http://domesdaymap.co.uk/api/1.0/place/20086?format=xml" let $http-get-data := httpclient:get(xs:anyURI($feeds-url), true(), <Headers/>) return $http-get-data This returns the xml without a problem. However, when I use a url query with more parameters such as : let $feeds-url := "http://domesdaymap.co.uk/api/1.0/placesnear?lat=52.5&lng=1.0&radius=10&format=xml" I get strange error messages as below: <exception><path>/db/punch/v4/domesdaytest.xq</path><message>expecting 't', found 'n'</message></exception> I have established that the message refers to specific characters in the url. When I truncate the url to a single parameter then I get a response from the api, not the one I want, but it explains why the simple url above worked and the more complex one does not. What I am deducing is that httpclient:get is only able to compile in the way that I am using it with a single parameter added. Is my understanding correct? If so are there alternative ways of approaching this? Or am I missing something? Thanks Peter -- Peter Watson |
From: Dannes W. <da...@ex...> - 2012-10-24 08:58:33
|
Hi On Wed, Oct 24, 2012 at 8:31 AM, Peter Watson <plw...@bl...>wrote: > This returns the xml without a problem. However, when I use a url query > with more parameters such as : > let $feeds-url := > " > http://domesdaymap.co.uk/api/1.0/placesnear?lat=52.5&lng=1.0&radius=10&format=xml > " > I get strange error messages as below: > > <exception><path>/db/punch/v4/domesdaytest.xq</path><message>expecting > 't', found 'n'</message></exception> > > I think you have to encode the URL, esp. & --> & cheers Dannes -- eXist-db Native XML Database - http://exist-db.org Join us on linked-in: http://www.linkedin.com/groups?gid=35624 |
From: Peter W. <pet...@ke...> - 2012-10-24 09:51:39
|
Thank you Dannes. I still forget the obvious. Peter On 24/10/2012 09:58, Dannes Wessels wrote: > Hi > > On Wed, Oct 24, 2012 at 8:31 AM, Peter Watson > <plw...@bl... <mailto:plw...@bl...>> > wrote: > > This returns the xml without a problem. However, when I use a url > query > with more parameters such as : > let $feeds-url := > "http://domesdaymap.co.uk/api/1.0/placesnear?lat=52.5&lng=1.0&radius=10&format=xml" > I get strange error messages as below: > > <exception><path>/db/punch/v4/domesdaytest.xq</path><message>expecting > 't', found 'n'</message></exception> > > > I think you have to encode the URL, esp. & --> & > > cheers > > Dannes > > > -- > eXist-db Native XML Database - http://exist-db.org > Join us on linked-in: http://www.linkedin.com/groups?gid=35624 > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > > > _______________________________________________ > Exist-open mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-open |