iJim Posted August 20, 2014 Share Posted August 20, 2014 Hi to everybody. I created a php file for add a new customer. I followed the documentation, and i send a POST request, but i have an error <error> <code><![CDATA[127]]></code> <message><![CDATA[XML error : String could not be parsed as XML this is my source code: try { define('PS_SHOP_PATH', '***'); define('PS_WS_AUTH_KEY', '***'); define('PS_WS_DEBUG', true); require_once( './PSWebServiceLibrary.php' ); $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, PS_WS_DEBUG); $opt = array(); $opt['url'] = PS_SHOP_PATH . '/api/customers?schema=synopsis'; $opt['resource'] = 'customers'; $xml = $webService->get($opt); $resources = $xml->children()->children(); foreach ($resources as $key => $resource){ $resources->$key = $_POST[$key]; } $xmlstr = $xml->asXML(); $opt = array('resource' => 'customers'); $opt['postXml'] = $xmlstr; $xml = $webService->add($opt); echo '-- OK --'; } catch (PrestaShopWebserviceException $ex) { ... } Link to comment Share on other sites More sharing options...
Wazzu Posted August 21, 2014 Share Posted August 21, 2014 Same problem here with 1.6.0.9 :-( I really cannot find an answer, it fails even with the example codes downloaded from https://github.com/PrestaShop/PrestaShop-webservice-lib Don't know if whether these samples are too old, PSWebServiceLibrary.php is outdated or api has a bug in this version (maybe the 2nd one). Which version are you using? Link to comment Share on other sites More sharing options...
iJim Posted August 21, 2014 Author Share Posted August 21, 2014 I'm using the version 1.6.0.9 !!! I can't fix this issue! Link to comment Share on other sites More sharing options...
Wazzu Posted August 21, 2014 Share Posted August 21, 2014 I've made the same test against 1.6.0.5 and has worked perfectly, so only 2 possible causes: outdated PSWebServiceLibrary.php api bug in version 1.6.0.9 Gonna try with 1.6.0.6 :-/ Link to comment Share on other sites More sharing options...
Wazzu Posted August 21, 2014 Share Posted August 21, 2014 I've made tests with 1.6.0.6, 1.6.0.7 and 1.6.0.8, all of them worked perfectly. Again with version 1.6.0.9 ir fails again: "XML error : String could not be parsed as XML" What do you think about it? Link to comment Share on other sites More sharing options...
iJim Posted August 21, 2014 Author Share Posted August 21, 2014 I will try it!Where can i download the PSWebServiceLibrary.php version 1.6.0.6 ? Link to comment Share on other sites More sharing options...
Wazzu Posted August 21, 2014 Share Posted August 21, 2014 (edited) Now I've copied dispatcher.php from 1.6.0.8 and overrided 1.6.0.9 Now it's working :-) I won't say it's "[sOLVED]" as this is just a testing solution Maybe there's a bug in dispatcher.php included in version 1.6.0.9 Let's play with diff tools :-) Version 1.6.0.10? where are you? Attached you'll finde dispacher from version 1.6.0.8 Please, be careful! backup everything! Not recommended for production environments! dispatcher.zip Edited August 21, 2014 by Wazzu (see edit history) Link to comment Share on other sites More sharing options...
iJim Posted August 21, 2014 Author Share Posted August 21, 2014 Thank you! It worked!!!!!!! I'm in debit whit you! I'm sorry for my english!If need some help in the future, you can contact me [email protected] Link to comment Share on other sites More sharing options...
Wazzu Posted August 21, 2014 Share Posted August 21, 2014 One more question, iJim Maybe you are using a windows-based hosting for your api tests? Link to comment Share on other sites More sharing options...
iJim Posted August 22, 2014 Author Share Posted August 22, 2014 No, i use linux ( Ubuntu ) and Mac OSX Link to comment Share on other sites More sharing options...
coddoc Posted August 22, 2014 Share Posted August 22, 2014 Please upvote bug report at http://forge.prestashop.com/browse/PSCFV-12460 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