Jump to content

After update to 1.6.1.17 (from 1.6.1.7) cannot add product via webservice


ITI
 Share

Recommended Posts

I've spend a lot of hours to see my problem, or to fix it. But no result.
Via the webservice i cannot add a product. (everything else works fine like categories...)
Before the update everything works fine.

The error is: AH01071: Got error 'PHP message: PHP Fatal error: Uncaught exception 'PrestaShopWebserviceException' with message 
'HTTP XML response is not parsable

After the update it looks like the response XML is not correct (only by products edit and add!)

The response is (below).

You see *id_lang = and so on, on every other webservice I use (like categories) there is no id_lang in the response.

I'll hope somebody can help me, if you need more info please tell me!
(the product is updated, but the code get stuck because of the error)
 

*id_lang = 1<br>*id_lang = <br>*id_lang = 2<br>*id_lang = <br>*id_lang = 3<br>*id_lang = <br>*id_lang = 4<br>*id_lang = <br>*id_lang = 5<br>*id_lang = <br>*id_lang = 6<br>*id_lang = <br>*id_lang = 1<br>*id_lang = <br>*id_lang = 2<br>*id_lang = <br>*id_lang = 3<br>*id_lang = <br>*id_lang = 4<br>*id_lang = <br>*id_lang = 5<br>*id_lang = <br>*id_lang = 6<br>*id_lang = <?xml version="1.0" encoding="UTF-8"?>
  <prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
  <product>
  <id><![CDATA[3890]]></id>
  <id_manufacturer></id_manufacturer>
  <id_supplier></id_supplier>
  <id_category_default xlink:href="https://www.mountwebshop.nl/api/categories/126"><![CDATA[126]]></id_category_default>
 

<new></new>
..... 

 

 

 

Edited by ITI (see edit history)

Share this post


Link to post
Share on other sites

It must be somewhere in your code. This part should not be there:

*id_lang = 1<br>*id_lang = <br>*id_lang = 2<br>*id_lang = <br>*id_lang = 3<br>*id_lang = <br>*id_lang = 4<br>*id_lang = <br>*id_lang = 5<br>*id_lang = <br>*id_lang = 6<br>*id_lang = <br>*id_lang = 1<br>*id_lang = <br>*id_lang = 2<br>*id_lang = <br>*id_lang = 3<br>*id_lang = <br>*id_lang = 4<br>*id_lang = <br>*id_lang = 5<br>*id_lang = <br>*id_lang = 6<br>*id_lang =

Share this post


Link to post
Share on other sites

Thats exact what I am searching for. Because before the update this problem was not there.
After the update I can edit categories, subcategories, but products give this display.
The product is edited!! but the code get stuck!

This is my code (XML Sent), hope you can help me?

XML SEND

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<product>
	<id_manufacturer format="isUnsignedId"/>
	<id_supplier format="isUnsignedId"/>
	<id_category_default format="isUnsignedId">126</id_category_default>
	<new/>
	
	
	
	<id_tax_rules_group format="isUnsignedId">53</id_tax_rules_group>
	
	
	
	<type notFilterable="true"/>
	<id_shop_default format="isUnsignedId"/>
	<reference maxSize="32" format="isReference"/>
	<supplier_reference maxSize="32" format="isReference"/>
	<location maxSize="64" format="isReference"/>
	<width format="isUnsignedFloat"/>
	<height format="isUnsignedFloat"/>
	<depth format="isUnsignedFloat"/>
	<weight format="isUnsignedFloat"/>
	<quantity_discount format="isBool"/>
	<ean13 maxSize="13" format="isEan13"/>
	<upc maxSize="12" format="isUpc"/>
	<cache_is_pack format="isBool"/>
	<cache_has_attachments format="isBool"/>
	<is_virtual format="isBool"/>
	<on_sale format="isBool">0</on_sale>
	<online_only format="isBool"/>
	<ecotax format="isPrice"/>
	<minimal_quantity format="isUnsignedInt">1</minimal_quantity>
	<price required="true" format="isPrice">349</price>
	<wholesale_price format="isPrice"/>
	<unity format="isString"/>
	<unit_price_ratio/>
	<additional_shipping_cost format="isPrice"/>
	<customizable format="isUnsignedInt"/>
	<text_fields format="isUnsignedInt"/>
	<uploadable_files format="isUnsignedInt"/>
	<active format="isBool">1</active>
	<redirect_type format="isString"/>
	<id_product_redirected format="isUnsignedId"/>
	<available_for_order format="isBool">1</available_for_order>
	<available_date format="isDateFormat"/>
	<condition format="isGenericName"/>
	<show_price format="isBool">1</show_price>
	<indexed format="isBool"/>
	<visibility format="isProductVisibility"/>
	<advanced_stock_management format="isBool"/>
	<date_add format="isDate">2016-01-01 00:00:00</date_add>
	<date_upd format="isDate"/>
	<pack_stock_type format="isUnsignedInt"/>
	<meta_description maxSize="255" format="isGenericName"><language id="6" xlink:href="https://www.mountwebshop.nl/api/languages/6" format="isUnsignedId"/></meta_description>
	<meta_keywords maxSize="255" format="isGenericName"><language id="6" xlink:href="https://www.mountwebshop.nl/api/languages/6" format="isUnsignedId"/></meta_keywords>
	<meta_title maxSize="128" format="isGenericName"><language id="6" xlink:href="https://www.mountwebshop.nl/api/languages/6" format="isUnsignedId"/></meta_title>
	<link_rewrite required="true" maxSize="128" format="isLinkRewrite"><language id="6" xlink:href="https://www.mountwebshop.nl/api/languages/6" format="isUnsignedId">ArvaAxiobeacon</language><language>ArvaAxiobeacon</language></link_rewrite>
	<name required="true" maxSize="128" format="isCatalogName"><language id="6" xlink:href="https://www.mountwebshop.nl/api/languages/6" format="isUnsignedId">Arva Axio beacon</language><language>Arva Axio beacon</language></name>
	<description format="isCleanHtml"><language id="6" xlink:href="https://www.mountwebshop.nl/api/languages/6" format="isUnsignedId"></language><language></language></description>
	<description_short format="isCleanHtml"><language id="6" xlink:href="https://www.mountwebshop.nl/api/languages/6" format="isUnsignedId"></language><language></language></description_short>
	<available_now maxSize="255" format="isGenericName"><language id="6" xlink:href="https://www.mountwebshop.nl/api/languages/6" format="isUnsignedId"/></available_now>
	<available_later maxSize="255" format="IsGenericName"><language id="6" xlink:href="https://www.mountwebshop.nl/api/languages/6" format="isUnsignedId"/></available_later>
<associations>
<categories nodeType="category" api="categories">
	<category>
	<id required="true"/>
	</category>
<category><id>2</id></category><category><id>119</id></category><category><id>126</id></category></categories>



<product_features nodeType="product_feature" api="product_features">
	<product_feature>
	<id required="true"/>
	<id_feature_value xlink:href="https://www.mountwebshop.nl/api/product_feature_values/" required="true"/>
	</product_feature>
</product_features>

<stock_availables nodeType="stock_available" api="stock_availables">
	<stock_available>
	<id required="true"/>
	<id_product_attribute required="true"/>
	</stock_available>
</stock_availables>
<accessories nodeType="product" api="products">
	<product>
	<id xlink:href="https://www.mountwebshop.nl/api/product/" required="true"/>
	</product>
</accessories>
<product_bundle nodeType="product" api="products">
	<product>
	<id required="true"/>
	<quantity/>
	</product>
</product_bundle>
<product_features><product_feature><id>14</id><custom>0</custom><id_feature_value>426673</id_feature_value></product_feature><product_feature><id>10</id><custom>0</custom><id_feature_value>30553</id_feature_value></product_feature><product_feature><id>11</id><custom>0</custom><id_feature_value>177</id_feature_value></product_feature><product_feature><id>12</id><custom>0</custom><id_feature_value>323944</id_feature_value></product_feature></product_features></associations>
<cache_default_attribute>19068</cache_default_attribute><id>3890</id></product>
</prestashop>


Code (after de webservice edit it get stuck!)
 

$resources->id = $art['prestashop_art_id'];
$opt = array('resource' => 'products', 'id'=>$art['prestashop_art_id']);
$opt['putXml'] = $xml->asXML();

// UITVOEREN!
$xml = $webService->edit($opt);


Apache Log
 

AH01071: Got error 'PHP message: PHP Fatal error: Uncaught exception 'PrestaShopWebserviceException' with message 'HTTP XML response is not parsable: array (\n 0 => \n LibXMLError::__set_state(array(\n 'level' => 3,\n 'code' => 64,\n 'column' => 378,\n 'message' => 'XML declaration allowed only at the start of the document\n',\n 'file' => '',\n 'line' => 1,\n )),\n 1 => \n LibXMLError::__set_state(array(\n 'level' => 3,\n 'code' => 77,\n 'column' => 1,\n 'message' => 'Premature end of data in tag br line 1\n',\n 'file' => '',\n 'line' => 132,\n )),\n 2 => \n LibXMLError::__set_state(array(\n 'level' => 3,\n 'code' => 77,\n 'column' => 1,\n 'message' => 'Premature end of data in tag br line 1\n',\n 'file' => '',\n 'line' => 132,\n )),\n 3 => \n LibXMLError::__set_state(array(\n 'level' => 3,\n 'code' => 77,\n 'column' => 1,\n 'message' => 'Premature end of data in tag br line 1\n',\n 'file' => '',\n 'line' => 132,\n )),\n 4 => \n LibXMLError::__set_state(arr...\n'

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More