For me it gives...
<http:response xmlns:http="http://expath.org/ns/http-client" status="400" message="Bad Request"> <http:header name="Server" value="nginx/1.11.5"/> <http:header name="Access-Control-Allow-Origin" value="*"/> <http:header name="Connection" value="keep-alive"/> <http:header name="Content-Length" value="37"/> <http:header name="Date" value="Mon, 14 Aug 2017 18:45:48 GMT"/> <http:header name="Content-Type" value="text/plain"/> <http:body media-type="text/plain"/> </http:response> Required argument 'data' is missing.
I think the below should work, but it does not
let $d:="Děti pojedou k babičce. Už se těší" return http:send-request(<http:request method='POST' href=' http://lindat.mff.cuni.cz/services/udpipe/api/process%27%3E <http:body media-type ="application/x-www-form-urlencoded">data={encode-for-uri($d)}&tokenizer&tagger&parser</http:body> </http:request>)
returns:
<http:response xmlns:http="http://expath.org/ns/http-client" status="400" message="Bad Request"> <http:header name="Server" value="nginx/1.11.5"/> <http:header name="Access-Control-Allow-Origin" value="*"/> <http:header name="Connection" value="keep-alive"/> <http:header name="Content-Length" value="113"/> <http:header name="Date" value="Mon, 14 Aug 2017 18:47:32 GMT"/> <http:header name="Content-Type" value="text/plain"/> <http:body media-type="text/plain"/> </http:response> Cannot read input data: The CoNLL-U line 'Děti pojedou k babičce. Už se těší' does not contain 10 columns!
Trying to directly emulate curl
let $target:="http://lindat.mff.cuni.cz/services/udpipe/api/process"
let $data:="Děti pojedou k babičce. Už se těší"
let $req:= <http:request method="POST" xmlns=" http://expath.org/ns/http-client%22%3E <multipart media-type="multipart/form-data"> <header name="Content-Disposition" value='form-data; name="tokenizer"'/> <body media-type="text/plain"/> <header name="Content-Disposition" value='form-data; name="tagger"'/> <body media-type="text/plain"/> <header name="Content-Disposition" value='form-data; name="parser"'/> <body media-type="text/plain"/> <header name="Content-Disposition" value='form-data; name="data"'/> <header name="Content-Transfer-Encoding" value='binary'/> <body media-type="text/plain" /> </multipart> </http:request> return http:send-request($req,$target,("","","",($data)))
This works, except when $data contains non 7bit chars, as here. In this case base64 data appears in place of the correct text.
It appears to be similar to this issue:
https://www.mail-archive.com/basex-talk@mailman.uni-konstanz.de/msg09206.htm...
/Andy
On 14 August 2017 at 19:04, Kendall Shaw kendall.shaw@workday.com wrote:
Can you elaborate on “does not work”? What response do you get.
*From: *Giuseppe Celano celano@informatik.uni-leipzig.de *Date: *Monday, August 14, 2017 at 10:43 AM *To: *Kendall Shaw kendall.shaw@workday.com *Cc: *BaseX basex-talk@mailman.uni-konstanz.de *Subject: *Re: [basex-talk] HTTP module
Thanks, Kendall, I tried but it does not work :(
Universität Leipzig Institute of Computer Science, Digital Humanities Augustusplatz 10 04109 Leipzig Deutschland E-mail: celano@informatik.uni-leipzig.de E-mail: giuseppegacelano@gmail.com Web site 1: http://www.dh.uni-leipzig.de/wo/team/ https://urldefense.proofpoint.com/v2/url?u=http-3A__www.dh.uni-2Dleipzig.de_wo_team_&d=DwMFaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=TlIOuppKOV4asTDc_0id-1Pvzd-oP7t4YHr2yE_Gq3A&s=dux16wNCZ5h2561adWMHR4ElYd_DdDGhkNgDiHLnFew&e= Web site 2: https://sites.google.com/site/giuseppegacelano/ https://urldefense.proofpoint.com/v2/url?u=https-3A__sites.google.com_site_giuseppegacelano_&d=DwMFaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=TlIOuppKOV4asTDc_0id-1Pvzd-oP7t4YHr2yE_Gq3A&s=Nt61VJ9xd6KArgVDT8ISIy7kOYiUYAKczZkMyWv2jh8&e=
On Aug 14, 2017, at 6:53 PM, Kendall Shaw kendall.shaw@workday.com wrote:
http:send-request(<http:request method='post'
href='http://lindat.mff.cuni.cz/services/udpipe/api/process https://urldefense.proofpoint.com/v2/url?u=http-3A__lindat.mff.cuni.cz_services_udpipe_api_process&d=DwMFaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=oFx2aqo7jCo5sUYE-dtOz0f9n3lLCHBvHn5wCV_mz_U&s=DaGziNTCuVsrynMx6YDP9swm59C7-6gsFKdm56BS0Aw&e= '>
<http:body media-type ="text/plain">
tokenizer&tagger&parser&data=Děti pojedou k babičce. Už se těší.
</http:body>
</http:request>)