I am trying to transmit this string as an HTTP Message BODY
url = "http://localhost:2480/batch/FILMSDB";
scrOK=Import["scrOK.m","Package"];
StringLength[scrOK]
1015
URLFetch[url, "StatusCode", "Method" -> "POST", "BodyData" -> scrOK]
200
scrOK is a batch SQL script that is executed successfully (200) on the OrientDB server
Now I am POSTing a different string, i.e. batch SQL script.
scrFail=Import["scrFail.m","Package"];
StringLength[scrFail]
1156
URLFetch[url, "StatusCode", "Method" -> "POST", "BodyData" -> scrFail]
$Failed
and I am getting the message
URLFetch::invhttp: Server returned nothing (no headers, no data). >>
It is clear that the problem has to do with the Content-Length limit on the server that has been set to 1024 characters. I tried to modify headers but it fails.
URLFetch["http://localhost:2480", "Headers" -> {"Content-Length" -> 1000}]
The value {Content-Length ->2000} specified for the option Headers \ is invalid.
URLFetch["http://localhost:2480", "Headers"][[7]]
{"Content-Length", "1350"}
URLFetch[url, "StatusCode", "Method" -> "POST", "Headers" -> {"Content-Length" -> 1200}, "BodyData" -> scrFail]
$Failed
What is really strange is that I have made the same tests on Google Chrome Postman App. The scrFail is passed and executed successfully. I am copying the curl code snippet
curl -X POST -H "Content-Type: text/plain" -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Cache-Control: no-cache" -H "Postman-Token: 3f9ab406-1013-4bb1-f07a-c53ef6cc09eb" -d
and then the body (scrFail) follows.....
I cannot draw a final conclusion whether this is a problem with OrientDB or there is a way in Wolfram Language to overcome the Content-Length limit of the server. What do you think, please help.
PS: Someone with higher reputation score should change the tag of the question to urlfetch
"Headers" -> {"Content-Length" -> "1200"}
? $\endgroup$