On 19 February 2011 07:24, Duncan Temple Lang <dun...@wald.ucdavis.edu>
wrote:

    Do you mean that the R variable page gives information about the request
error
    and contains the 500 error code? Not sure what you mean by "screen"
here.


Yes that's exactly what I mean


    Client-server interactions are hard to debug as the problems can be on
either
    side or in the communication.  The error can be in your request, in
RCurl,
    on the server side receiving the request or in the script processing the
request
    on the server.


And I am (all too) aware of this. From the command line, it works fine,
using curl:
% curl -vvv -u "test:test" -d "profileid=-1" -d "value=1.801"
-d"type=history" http://our.server.com/dbInt/new
* About to connect() to our.server.com port 80 (#0)
*   Trying 192.168.2.23 ... connected
* Connected to our.server.com (192.168.2.23) port 80 (#0)
* Server auth using Basic with user 'test'
> POST /dbInt/new HTTP/1.1
> Authorization: Basic dGVzdDp0ZXN0
> User-Agent: curl/7.21.0 (i686-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o
zlib/1.2.3.4 libidn/1.18
> Host: our.server.com
> Accept: */*
> Content-Length: 37
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 201 Created
< Date: Tue, 22 Feb 2011 19:09:01 GMT
< Content-Length: 0
< Server: Jetty(6.1.25)

The equivalent code in RCurl would be:
postForm('http://our.server.com/dbInt/new',
curlOptions=(userpwd="test:test"), profileid = "-1", value="1.801",
type="history")

When I do run this code in R, I get:
[1] "<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;
charset=ISO-8859-1\"/>\n<title>Error 401
UNAUTHORIZED</title>\n</head>\n<body><h2>HTTP ERROR 401</h2>\n<p>Problem
accessing /dbInt/new. Reason:\n<pre>    UNAUTHORIZED</pre></p><hr
/><i><small>Powered by
Jetty://</small></i><br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n\n</body>\n</html>\n"
attr(,"Content-Type")
                  charset
 "text/html" "iso-8859-1"
Adding verbose=T to curlOptions results in an 'unexpected "," in
curlOptions', adding the verbose='true' to opts instead yields the same
result as above. If you should require further information, please ask. Many
thanks!

    So it is imperative to try to get diagnostic information.

    You used verbose = T  (TRUE).  What did that display?


Nothing


    postForm() has a style parameter. It controls how the POST request is
    submitted, either application/x-www-form-urlencoded or
multipart/form-data.
    Your server script might be expecting the data in a different format
    than is being sent. postForm() defaults to the www-form-urlencoded.

    But we will need more information to help you if these are not the
    cause of the problem.

-- 
Hasan Diwan
Developer
Economic Risk Management LLC

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to