From: Stéphane S. <ste...@ep...> - 2012-05-25 17:52:10
|
Hi, I am trying to call a SOAP service (Paypal, using "post") with the send-request() method of the HTTP Client module in eXist, taking inspiration from this example [1]. However the result is that I get a "411 Length Required" error. Note that the request endpoint is an HTTPS endpoint ("https://api-3t.sandbox.paypal.com/2.0/"). Here is the beginning of the $req object that I send using http:send-request($req) : <http:request href="https://api-3t.sandbox.paypal.com/2.0/" method="post"> <http:header name="SOAPAction" value="SetExpressCheckout"/> <http:body media-type="text/xml"> ... Note that if I try to manually set a Content-length by adding a header to the request with an arbitrary value: <http:header name="Content-length" value="1000"/> Then I get an exception from the HTTP Client module : Error found Error executing the HTTP method Java Stack Trace:Class Name Method Name File Name Line org.expath.exist.SendRequestFunction sendRequest SendRequestFunction.java 150 So I would like to know if the http:send-request method sets the Content-lenght header, and if not how to set it manually ? Note that to import the HTTP Client module with eXist 1.4.1-rev15155, I had to comment the following lines in 'conf.xml' (taking ideas from this thread [2]), since otherwise XQuery throws an exception. I guess eXist 1.4.2. does not fix the problem either, since it still contains the old "http-client.xqm" module uncommented in conf.xml. <!-- EXPath Modules --> <module uri="http://expath.org/ns/http-client" class="org.expath.exist.HttpClientModule" /> <!-- <module uri="http://www.expath.org/mod/http-client" src="resource:org/expath/www/mod/http-client/http-client.xqm" /> --> <!-- Native EXPath HTTPClient Module --> <!-- <module uri="http://exist-db.org/xquery/httpclient" class="org.exist.xquery.modules.httpclient.HTTPClientModule" /> --> When setting up conf.xml as above, you can then load the HTTP Client module without throwing an exception using: import module namespace http = "http://expath.org/ns/http-client"; Thanks in advance for any help, Stéphane S. --- [1] http://www.expath.org/modules/http-client/samples#soap [2] http://exist-open.markmail.org/thread/66naklwxfidvbht5 |