0

Currently i am Working for Android Magento api integration. For that i am using Ksoap2 library to parse Soap Response in android...i m having trouble to get category image.

http://www.magentocommerce.com/api/soap/catalog/catalogCategory/catalog_category.info.html

i used "catalogCategoryInfo" method to get specific category information. And getting response like this:

catalogCategoryInfo{
 category_id=3; 
 is_active=1; 
 position=1; 
 level=2; 
 parent_id=2; 
 all_children=3; 
 children=; 
 created_at=2014-07-31T17:43:35+05:30; 
 updated_at=2014-11-24 06:38:01; 
 name=Wedding Collections; 
 url_key=t-shirt; path=1/2/3; 
 url_path=t-shirt.html; 
 children_count=0; 
 display_mode=PRODUCTS; 
 is_anchor=0; 
 available_sort_by=ArrayOfString{}; 
 default_sort_by=position; 
}

There is no field like "image"(in SOAP v1 response "image" field is available.see above url). i checked responseobject.getPropertyCount() for total number of attributes..but getting only 18 attributes. how can i get category image url?

0

This seams like a bug or something that was overlooked.
Let me take it step by step.
First take a look at the definition of the catalogCategoryInfo operation from the wsdl.xml file inside the Mage_Catalog module

<operation name="catalogCategoryInfo">
    <documentation>Retrieve hierarchical tree of categories.</documentation>
    <input message="typens:catalogCategoryInfoRequest"/>
    <output message="typens:catalogCategoryInfoResponse"/>
</operation>

You will see that the response has the type catalogCategoryInfoResponse.
This one looks like this:

<message name="catalogCategoryInfoResponse">
    <part name="info" type="typens:catalogCategoryInfo"/>
</message>

This means that it will return one object of type catalogCategoryInfo. This one is:

         <complexType name="catalogCategoryInfo">
            <all>
                <element name="category_id" type="xsd:string"/>
                <element name="is_active" type="xsd:int"/>
                <element name="position" type="xsd:string"/>
                <element name="level" type="xsd:string"/>
                <element name="parent_id" type="xsd:string"/>
                <element name="all_children" type="xsd:string"/>
                <element name="children" type="xsd:string"/>
                <element name="created_at" type="xsd:string" minOccurs="0"/>
                <element name="updated_at" type="xsd:string" minOccurs="0"/>
                <element name="name" type="xsd:string" minOccurs="0"/>
                <element name="url_key" type="xsd:string" minOccurs="0"/>
                <element name="description" type="xsd:string" minOccurs="0"/>
                <element name="meta_title" type="xsd:string" minOccurs="0"/>
                <element name="meta_keywords" type="xsd:string" minOccurs="0"/>
                <element name="meta_description" type="xsd:string" minOccurs="0"/>
                <element name="path" type="xsd:string" minOccurs="0"/>
                <element name="url_path" type="xsd:string" minOccurs="0"/>
                <element name="children_count" type="xsd:int" minOccurs="0"/>
                <element name="display_mode" type="xsd:string" minOccurs="0"/>
                <element name="is_anchor" type="xsd:int" minOccurs="0"/>
                <element name="available_sort_by" type="typens:ArrayOfString" minOccurs="0"/>
                <element name="custom_design" type="xsd:string" minOccurs="0"/>
                <element name="custom_design_apply" type="xsd:string" minOccurs="0"/>
                <element name="custom_design_from" type="xsd:string" minOccurs="0"/>
                <element name="custom_design_to" type="xsd:string" minOccurs="0"/>
                <element name="page_layout" type="xsd:string" minOccurs="0"/>
                <element name="custom_layout_update" type="xsd:string" minOccurs="0"/>
                <element name="default_sort_by" type="xsd:string" minOccurs="0"/>
                <element name="landing_page" type="xsd:int" minOccurs="0"/>
            </all>
        </complexType>

As you can see there is not image or thumbnail element among the ones returned.
I don't know if this is a bug or a feature or someone simple overlooked it.

But here is what you can do. You can create your own module that will add the image attribute in the list of returned values from the method call.
Follow this example. It is for extending the product response, but it works the same for categories.
The idea is to take advantage of the fact that all the wsdl.xml files from all modules are merged into one big one. You can create your own, and following the same xpath as in the wsdl file for the catalog, add a new attribute to the response.

  • Thank you Marius for this answer...but i can't find customer login method..how can i get customer session ID that require to pass in almost methods? currently i m using userApi generated session id to get categories & products data.Should i go with SOAP or REST? which is advisable? – Alex Nov 28 '14 at 10:18
  • @Alex. This is a totally different question. Please as an other question and explain in as much details as possible what you need. – Marius Nov 28 '14 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.