jatin_kacha Posted January 8, 2014 Share Posted January 8, 2014 I have a problem creating new customer's address via web service.Web service POST request URL = http://mkp.co.in/myprshop2/api/addresses?ws_key=GHSCR4BZ6B6VHX5W1EYZDAOXYI9NYMQHFollowing is the content i am sending:<prestashop xmlns:xlink="http://www.w3.org/1999/xlink"><address> <id><![CDATA[]]></id> <id_customer><![CDATA[2]]></id_customer> <id_manufacturer><![CDATA[0]]></id_manufacturer> <id_supplier><![CDATA[0]]></id_supplier> <id_warehouse><![CDATA[0]]></id_warehouse> <id_country><![CDATA[8]]></id_country> <id_state><![CDATA[0]]></id_state> <alias><![CDATA[My address]]></alias> <company><![CDATA[]]></company> <lastname><![CDATA[Kacha]]></lastname> <firstname><![CDATA[Jatin]]></firstname> <vat_number></vat_number> <address1><![CDATA[2, Mehul Nagar, Bh. Nilkanth cinema]]></address1> <address2><![CDATA[]]></address2> <postcode><![CDATA[360002]]></postcode> <city><![CDATA[Rjt]]></city> <other><![CDATA[]]></other> <phone><![CDATA[992552894]]></phone> <phone_mobile></phone_mobile> <dni><![CDATA[]]></dni> <deleted><![CDATA[0]]></deleted> <date_add><![CDATA[]]></date_add> <date_upd><![CDATA[]]></date_upd></address></prestashop>It returns:<?xml version="1.0" encoding="UTF-8"?><prestashopxmlns:xlink="http://www.w3.org/1999/xlink"><errors><error><code><![CDATA[127]]></code><message><![CDATA[xml error : String could not be parsed as XMLXML length : 0Original XML : ]]></message></error></errors></prestashop>I did try by appending XML content in the URL itself like:xml=<prestashop xmlns:xlink="http://www.w3.org/1999/xlink"><address> <id><![CDATA[]]></id> <id_customer><![CDATA[2]]></id_customer> <id_manufacturer><![CDATA[0]]></id_manufacturer> <id_supplier><![CDATA[0]]></id_supplier> <id_warehouse><![CDATA[0]]></id_warehouse> <id_country><![CDATA[8]]></id_country> <id_state><![CDATA[0]]></id_state> <alias><![CDATA[My address]]></alias> <company><![CDATA[]]></company> <lastname><![CDATA[Kacha]]></lastname> <firstname><![CDATA[Jatin]]></firstname> <vat_number></vat_number> <address1><![CDATA[2, Mehul Nagar, Bh. Nilkanth cinema]]></address1> <address2><![CDATA[]]></address2> <postcode><![CDATA[360002]]></postcode> <city><![CDATA[Rjt]]></city> <other><![CDATA[]]></other> <phone><![CDATA[992552894]]></phone> <phone_mobile></phone_mobile> <dni><![CDATA[]]></dni> <deleted><![CDATA[0]]></deleted> <date_add><![CDATA[]]></date_add> <date_upd><![CDATA[]]></date_upd></address></prestashop>But same error.I used RESTClient firefox Addon, programatically through PHP, but same error returned.Can anyone please help me?Paid / professional help will also be welcome. Its critical for me, and need to solve it urgent.Thanks in advance Link to comment Share on other sites More sharing options...
muktadir Posted January 8, 2014 Share Posted January 8, 2014 hi, Can you post the "post" data exactly as you send to the server? (you can try printing the whole 'post' array in browser and copy it from 'view source' window. There can be some errors with the data structure. Thanks, Muktadir Link to comment Share on other sites More sharing options...
jatin_kacha Posted January 8, 2014 Author Share Posted January 8, 2014 Muktadir, Here is the XML i send in POST request body. <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"><address> <id><![CDATA[]]></id> <id_customer><![CDATA[2]]></id_customer> <id_manufacturer><![CDATA[0]]></id_manufacturer> <id_supplier><![CDATA[0]]></id_supplier> <id_warehouse><![CDATA[0]]></id_warehouse> <id_country><![CDATA[8]]></id_country> <id_state><![CDATA[0]]></id_state> <alias><![CDATA[My address]]></alias> <company><![CDATA[]]></company> <lastname><![CDATA[Kacha]]></lastname> <firstname><![CDATA[Jatin]]></firstname> <vat_number></vat_number> <address1><![CDATA[2, Mehul Nagar, Bh. Nilkanth cinema]]></address1> <address2><![CDATA[]]></address2> <postcode><![CDATA[360002]]></postcode> <city><![CDATA[Rjt]]></city> <other><![CDATA[]]></other> <phone><![CDATA[992552894]]></phone> <phone_mobile></phone_mobile> <dni><![CDATA[]]></dni> <deleted><![CDATA[0]]></deleted> <date_add><![CDATA[]]></date_add> <date_upd><![CDATA[]]></date_upd></address></prestashop> I also try making a post request like: In some thread, few people has also guided to pass XML data in query string itself. http://mkp.co.in/myprshop2/api/addresses?ws_key=GHSCR4BZ6B6VHX5W1EYZDAOXYI9NYMQH&xml=<prestashop xmlns:xlink="http://www.w3.org/1999/xlink"><address> <id><![CDATA[]]></id> <id_customer><![CDATA[2]]></id_customer> <id_manufacturer><![CDATA[0]]></id_manufacturer> <id_supplier><![CDATA[0]]></id_supplier> <id_warehouse><![CDATA[0]]></id_warehouse> <id_country><![CDATA[8]]></id_country> <id_state><![CDATA[0]]></id_state> <alias><![CDATA[My address]]></alias> <company><![CDATA[]]></company> <lastname><![CDATA[Kacha]]></lastname> <firstname><![CDATA[Jatin]]></firstname> <vat_number></vat_number> <address1><![CDATA[2, Mehul Nagar, Bh. Nilkanth cinema]]></address1> <address2><![CDATA[]]></address2> <postcode><![CDATA[360002]]></postcode> <city><![CDATA[Rjt]]></city> <other><![CDATA[]]></other> <phone><![CDATA[992552894]]></phone> <phone_mobile></phone_mobile> <dni><![CDATA[]]></dni> <deleted><![CDATA[0]]></deleted> <date_add><![CDATA[]]></date_add> <date_upd><![CDATA[]]></date_upd></address></prestashop> Link to comment Share on other sites More sharing options...
jatin_kacha Posted January 8, 2014 Author Share Posted January 8, 2014 Muktadir, For your reference, the same POST request is working in another setup, which is running prestashop 1.5.5 version. It is not working only in prestashop 1.5.4.1 version. So if this help you. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts