I try to use the Open Calais REST API with XQuery. I have had no problems with GET requests, but if the content gets biggish the URL would be too long. So I tried POST requests like the "Calais test page" does.
Unfortunately all I get from Calais is an <Error> with an <Exception> containing the stack trace of a NullPointerException. To reproduce this go to http://try.zorba-xquery.com/ and copy&paste the following code which does the corresponding POST request:
import module namespace rest = "http://www.zorba-xquery.com/zorba/rest-functions";
let $content := "Hello John Doe."
let $paramsXML := '<c:params xmlns:c="http://s.opencalais.com/1/pred/">
let $p := <rest:payload content-type="multipart/form-data">
let $response := rest:post("http://api.opencalais.com/enlighten/rest/", $p)
I also tried to specify the content type as "application/x-www-form-urlencoded" and put the argument line as a whole in the payload. But this results in a 403 response code (which I find confusing as well).
Every comment is appreciated.