tehy Posted March 16, 2015 Share Posted March 16, 2015 Hi. I'm having a strange problem. I'm using the webservice via direct cURL calls, because I had problems with the PSWebServiceLibrary doing stupid things and mainly just getting in the way (though I did briefly test this with the library as well, with the same error). I'm trying to add order_histories via the webservice to update the order status and history (as merely updating the order via the orders resource doesn't change the order history, and I'm not sure if it'll send the email to the customer either). Anyway, for some strange reason it does not work. Editing an existing order_histories with PUT request works, but as soon as I try to POST, I get this error: <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <errors> <error> <code><![CDATA[127]]></code> <message><![CDATA[xml error : String could not be parsed as XML XML length : 0 Original XML : ]]></message> </error> </errors> </prestashop> The obvious problem is XML length: 0. As if I hadn't sent the XML at all. But the Content-Length of my outgoing request isn't 0, so the XML itself is definitely being sent in CURLOPT_POSTFIELDS. And the exact same function (except for the different CURLOPT_CUSTOMREQUEST setting, and of course adding the ID for PUT in the XML data) is sending the PUT request where the XML is recognized (if there's a problem with the XML I get an error as I should, but even then XML length is correct and the original XML is listed). So basically everything else being identical, PUT request works, POST doesn't. What on earth could cause this? I've been banging my head at this for hours, with no luck. Link to comment Share on other sites More sharing options...
tehy Posted March 16, 2015 Author Share Posted March 16, 2015 (edited) Ugh, actually got it to work, after some more googling found that I had to add 'xml=' in front of the XML payload. But even the PSWebServiceLibrary doesn't seem to do that, further lowering my opinion of said library. Now the only problem remaining is emails don't get set upon the statusupdate, despite the ?sendemail=1 in the resource URL. Edited March 16, 2015 by tehy (see edit history) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now