2015-08-25 2 views
1

Когда я разбираю данные изображения с использованием web-сервисов prestashop в формате xml, он отлично работает, но когда я меняю выходной формат на JSON, он получает ошибку.prestashop webservices для изображения в формате json

В результате в формате XML является

<?xml version="1.0" encoding="UTF-8"?> 
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> 
    <image_types> 
     <image_type id="7" name="category_default" xlink:href="http://abcd.com/api/image_types/7"/> 
     <image_type id="3" name="medium_default" xlink:href="http://abcd.com/api/image_types/3"/> 
    </image_types> 
    <images> 
     <image id="10" xlink:href="http://abcd.com/api/images/categories/10"/> 
     <image id="11" xlink:href="http://abcd.com/api/images/categories/11"/> 
     <image id="3" xlink:href="http://abcd.com/api/images/categories/3"/> 
     <image id="4" xlink:href="http://abcd.com/api/images/categories/4"/> 
     <image id="5" xlink:href="http://abcd.com/api/images/categories/5"/> 
     <image id="6" xlink:href="http://abcd.com/api/images/categories/6"/> 
     <image id="7" xlink:href="http://abcd.com/api/images/categories/7"/> 
     <image id="8" xlink:href="http://abcd.com/api/images/categories/8"/> 
     <image id="9" xlink:href="http://abcd.com/api/images/categories/9"/> 
    </images> 
</prestashop> 

в результате формате JSON является

{"":[{"id":"7"},{"id":"3"},{"id":"10"},{"id":"11"},{"id":"3"},{"id":"4"},{"id":"5"},{"id":"6"},{"id":"7"},{"id":"8"},{"id":"9"}],"errors":[{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."}]} 

пожалуйста, помогите

+0

Я также вижу эту проблему при получении изображений в JSON vs XML – Francois

ответ

0

использовать это, чтобы получить изображение с веб-сервисов PrestaShop

<img src="http://abcd.com/api/images/products/{{product_id}}/{{image_id}}?ws_key=DS2FHJQQQSAG381PB52237254DVK9R14"> 

и получите идентификатор продукта и идентификатор изображения из вашего списка продуктов xml/json. Поместите этот идентификатор на этот URL-адрес изображения, и вы получите свое изображение.