| From | Sent On | Attachments |
|---|---|---|
| "Stéphane S." | May 25, 2012 10:51 am | |
| Stéphane S. | May 28, 2012 3:06 pm | |
| Florent Georges | Jun 11, 2012 8:27 am |
| Subject: | [Exist-open] HTTP 411 error using HTTP Client module (does it set Content-lenght header) ? | |
|---|---|---|
| From: | "Stéphane S." (step...@epfl.ch) | |
| Date: | May 25, 2012 10:51:36 am | |
| List: | net.sourceforge.lists.exist-open | |
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
------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ Exist-open mailing list Exis...@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/exist-open





