title: Prestashop webservice create order
body: <p>I'm trying to create API connection to prestashop via webservices</p>
  
  <p>I can create Custommers, Addresses, Carts succesfully
  (there is available well known pure documentation about customers CRUD,
  it works as expected)</p>
  
  <p>I'm not able to complete new Order:</p>
  
  <p>There is source code fragment</p>
  
  <pre><code>require_once('config.php'); // PS_SHOP_PATH etc.
  require_once('PSWebServiceLibrary.php');
  
   try
   {
  $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
  $opt = array('resource' =&gt; 'orders');
  $xml = $webService-&gt;get(array('url' =&gt; PS_SHOP_PATH.'/api/orders?schema=blank'));
  
  $xml-&gt;children()-&gt;children()-&gt;id_address_delivery = 1; 
  $xml-&gt;children()-&gt;children()-&gt;id_address_invoice =  1; 
  $xml-&gt;children()-&gt;children()-&gt;id_cart = 25; 
  $xml-&gt;children()-&gt;children()-&gt;id_currency = 1;
  $xml-&gt;children()-&gt;children()-&gt;current_state = 1;
  $xml-&gt;children()-&gt;children()-&gt;id_lang = 1;
  $xml-&gt;children()-&gt;children()-&gt;id_customer = 1; 
  $xml-&gt;children()-&gt;children()-&gt;id_carrier = 0;
  $xml-&gt;children()-&gt;children()-&gt;total_paid = '56973';
  $xml-&gt;children()-&gt;children()-&gt;total_paid_real = '56973';
  $xml-&gt;children()-&gt;children()-&gt;total_paid_tax_excl = '56973';
  $xml-&gt;children()-&gt;children()-&gt;total_paid_tax_incl = '56977';
  $xml-&gt;children()-&gt;children()-&gt;total_products = 1338;
  $xml-&gt;children()-&gt;children()-&gt;total_products_wt = 1337;
  $xml-&gt;children()-&gt;children()-&gt;conversion_rate = '1';
  $xml-&gt;children()-&gt;children()-&gt;secure_key = md5('-1');;
  $xml-&gt;children()-&gt;children()-&gt;valid = 1;
  $xml-&gt;children()-&gt;children()-&gt;module = 'Bankwire';
  $xml-&gt;children()-&gt;children()-&gt;payment = 'bankwire';
  $xml-&gt;children()-&gt;children()-&gt;current_state = 1;
  
  unset($xml-&gt;children()-&gt;children()-&gt;id);
  unset($xml-&gt;children()-&gt;children()-&gt;date_add);
  unset($xml-&gt;children()-&gt;children()-&gt;date_upd);
  unset($xml-&gt;children()-&gt;children()-&gt;associations);
  unset($xml-&gt;children()-&gt;children()-&gt;delivery_date);
  unset($xml-&gt;children()-&gt;children()-&gt;invoice_date);
  unset($xml-&gt;children()-&gt;children()-&gt;total_discounts_tax_incl);
  unset($xml-&gt;children()-&gt;children()-&gt;total_discounts_tax_excl);
  
  
  $xml = $webService-&gt;add(array('resource' =&gt; 'orders',
  'postXml' =&gt; $xml-&gt;asXML()
  ));
  
  $resources = $xml-&gt;children()-&gt;children();
  echo "Successfully added order.".$resources-&gt;id;
  
  }
  catch (PrestaShopWebserviceException $ex)
  {
      // Here we are dealing with errors
      $trace = $ex-&gt;getTrace();
      if ($trace[0]['args'][0] == 404) echo 'Bad ID';
      else if ($trace[0]['args'][0] == 401) echo 'Bad auth key';
      else echo 'Other error&lt;br /&gt;'.$ex-&gt;getMessage();
  }
  </code></pre>
  
  <p>And there is part. webview log from Fiddler</p>
  
  <pre><code>     XML SENT
  
     xml=&lt;?xml version="1.0" encoding="UTF-8"?&gt;
     &lt;prestashop xmlns:xlink="http://www.w3.org/1999/xlink"&gt;
     &lt;order&gt;
  
      &lt;id_address_delivery&gt;1&lt;/id_address_delivery&gt;
      &lt;id_address_invoice&gt;1&lt;/id_address_invoice&gt;
      &lt;id_cart&gt;25&lt;/id_cart&gt;
      &lt;id_currency&gt;1&lt;/id_currency&gt;
      &lt;id_lang&gt;1&lt;/id_lang&gt;
      &lt;id_customer&gt;1&lt;/id_customer&gt;
      &lt;id_carrier&gt;0&lt;/id_carrier&gt;
      &lt;current_state&gt;1&lt;/current_state&gt;
      &lt;module&gt;Bankwire&lt;/module&gt;
      &lt;invoice_number/&gt;
  
      &lt;delivery_number/&gt;
  
      &lt;valid&gt;1&lt;/valid&gt;
  
  
      &lt;id_shop_group/&gt;
      &lt;id_shop/&gt;
      &lt;secure_key&gt;6bb61e3b7bce0931da574d19d1d82c88&lt;/secure_key&gt;
      &lt;payment&gt;bankwire&lt;/payment&gt;
      &lt;recyclable/&gt;
      &lt;gift/&gt;
      &lt;gift_message/&gt;
      &lt;mobile_theme/&gt;
      &lt;total_discounts/&gt;
  
  
      &lt;total_paid&gt;56973&lt;/total_paid&gt;
      &lt;total_paid_tax_incl&gt;56977&lt;/total_paid_tax_incl&gt;
      &lt;total_paid_tax_excl&gt;56973&lt;/total_paid_tax_excl&gt;
      &lt;total_paid_real&gt;56973&lt;/total_paid_real&gt;
      &lt;total_products&gt;1338&lt;/total_products&gt;
      &lt;total_products_wt&gt;1337&lt;/total_products_wt&gt;
      &lt;total_shipping/&gt;
      &lt;total_shipping_tax_incl/&gt;
      &lt;total_shipping_tax_excl/&gt;
      &lt;carrier_tax_rate/&gt;
      &lt;total_wrapping/&gt;
      &lt;total_wrapping_tax_incl/&gt;
      &lt;total_wrapping_tax_excl/&gt;
      &lt;shipping_number/&gt;
      &lt;conversion_rate&gt;1&lt;/conversion_rate&gt;
      &lt;reference/&gt;
  
     &lt;/order&gt;
     &lt;/prestashop&gt;
  </code></pre>
  
  <p>RETURN HTTP BODY 
     Fatal error
     Other error</p>
  
  <pre><code> HTTP XML response is not parsable : array ( 0 =&gt; LibXMLError::__set_state(array(     'level'    =&gt; 3, 'code' =&gt; 4, 'column' =&gt; 1, 'message' =&gt; 'Start tag expected, \'&lt;\' not found ',     'file' =&gt; '', 'line' =&gt; 1, )), )
  </code></pre>
  
  <p>"Other error" comes from this:</p>
  
  <pre><code>  else echo 'Other error&lt;br /&gt;'.$ex-&gt;getMessage();
  </code></pre>
  
  <p>PSWebServiceLibrary contains</p>
  
  <pre><code>/** @var array compatible versions of PrestaShop Webservice */
  const psCompatibleVersionsMin = '1.4.0.17';
  const psCompatibleVersionsMax = '1.5.4.1';
  </code></pre>
  
  <p>PrestaShop is 1.5.4.0</p>
  
  <p>Any advice?</p>