Jump to content

Issue with webservice when saving XML


Recommended Posts

Hi there,

 

I'm trying to change the quantity of a combination using the webservices of prestashop 1.5.2.

 

I'm able to read the data but when I'm trying to save the XML also without changing anything, the system report this error:

 

 

Error : HTTP XML response is not parsable : array (

0 =>

LibXMLError::__set_state(array(

'level' => 3,

'code' => 4,

'column' => 1,

'message' => 'Start tag expected, \'<\' not found

',

'file' => '',

'line' => 1,

)),

)

 

For verification I've changed only the resources to customers and the same code work.

 

Anyone can help me?

 

Thanks

Ale

 

-- EDIT --

 

My code is:

 

 

try

{

$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);

$opt['resource'] = 'stock_availables';

$opt['id'] = 20;

$xml_stock_combination = $webService->get($opt);

$stock_combination_av = $xml_stock_combination->children()->children();

}

catch (PrestaShopWebserviceException $e)

{

echo '<b>Error : '.$e->getMessage().'</b>';

}

 

 

foreach ($stock_combination_av as $nodeKey => $node)

{

$stock_combination_av->$nodeKey = $stock_combination_av->$nodeKey;

}

 

 

try {

$opt = array('resource' => 'stock_availables');

$opt['id'] = 20;

$opt['putXml'] = $xml_stock_combination->asXML();

 

// ERROR ARRIVES AFTER THIS CALL

$xml_stock_combination = $webService->edit($opt);

 

echo "<br>XML EDITED<br>";

 

echo "</pre>";

}

catch (PrestaShopWebserviceException $e)

{

echo '<b>Error : '.$e->getMessage().'</b>';

}

Edited by AL-DEV (see edit history)
Link to comment
Share on other sites

  • 1 year later...
  • 2 weeks later...
×
×
  • Create New...