Roland Krause
2017-07-10 13:16:06 UTC
Hi all,
I installed basex for keeping and updating XML files.
I can load a XML into a browser with javascript
...
var xhr = new XMLHttpRequest();
xhr.open( "GET", "http://localhost:8984/rest/XMLfiles/cmuInput.xml", true);
xhr.send();
var xml = xhr.responseXML;
...
but if I try to PUT something, it will not work.
...
var xhr = new XMLHttpRequest();
xhr.open( "PUT", "http://localhost:8984/rest/XMLfiles/test.xml", true);
xhr.setRequestHeader("Authorization", "Basic " + btoa("admin:admin"));
xhr.send("<ALLES>hat ein Ende, nur die Wurst hat zwei</ALLES>");
â...â
*[HTTP/1.1 400 Bad Request 6ms]*
âBUT it works with *curl*â
echo "<ALLES>hat ein Ende, nur die Wurst hat zwei</ALLES>" | *curl* -u
admin:admin -i -X PUT -T - "http://
âlocalhostâ
:8984/rest/XMLfiles/
âtest
.xml"
HTTP/1.1 201 Created
Content-Type: text/plain;charset=UTF-8
Content-Length: 36
Server: Jetty(8.1.18.v20150929)
1 resource(s) replaced in 32.91 ms.
âI need help here!â
I installed basex for keeping and updating XML files.
I can load a XML into a browser with javascript
...
var xhr = new XMLHttpRequest();
xhr.open( "GET", "http://localhost:8984/rest/XMLfiles/cmuInput.xml", true);
xhr.send();
var xml = xhr.responseXML;
...
but if I try to PUT something, it will not work.
...
var xhr = new XMLHttpRequest();
xhr.open( "PUT", "http://localhost:8984/rest/XMLfiles/test.xml", true);
xhr.setRequestHeader("Authorization", "Basic " + btoa("admin:admin"));
xhr.send("<ALLES>hat ein Ende, nur die Wurst hat zwei</ALLES>");
â...â
*[HTTP/1.1 400 Bad Request 6ms]*
âBUT it works with *curl*â
echo "<ALLES>hat ein Ende, nur die Wurst hat zwei</ALLES>" | *curl* -u
admin:admin -i -X PUT -T - "http://
âlocalhostâ
:8984/rest/XMLfiles/
âtest
.xml"
HTTP/1.1 201 Created
Content-Type: text/plain;charset=UTF-8
Content-Length: 36
Server: Jetty(8.1.18.v20150929)
1 resource(s) replaced in 32.91 ms.
âI need help here!â
--
Kind regards,
*Roland*
Kind regards,
*Roland*