Question

I want to extend the SOAP API for the category with own attributes.

  • The first attribute is a simple text-value that should be stored in the database.
  • The second attribute should be used to upload the category-image. Later it will be a complexType but for testing it is a simple string-element (like the first attribute). I want to transport the image-data with this attribute, save the physical image file in the update/create-function and set the attribute "thumbnail" in the category-object. So I don't need to store the second attribute in the database.

For this I've created a new extension with an install-script to create the first attribute. I've also created the file wsi.xml to insert both attributes in the WSDL for SOAP and extended Mage_Catalog_Model_Category_Api_V2 to manipulate the update-action for my needs. This works already. Both attributes are displayed in the WSDL.

This is how I've added the attributes in wsi.xml:

        ...
        <xsd:complexType name="catalogCategoryEntityCreate">
            <xsd:sequence>
                <xsd:element name="my_attribute_1" type="xsd:string" minOccurs="0" />
                <xsd:element name="my_attribute_2" type="xsd:string" minOccurs="0" />
            </xsd:sequence>
        </xsd:complexType>
        ...

Now when I run catalogCategoryUpdate() I can set the first attribute (that I have inserted with my own extension and the install-script) and the value will be stored.

Now the problem: It seems that the second attribute (that I only need in the API) is not transferred to my update-function. When I dump the variable $categoryData into a logfile (to see whats in it) I can see that the second attribute is not there. I think magento removes this attribute because I haven't defined it in the install script.

The question: How can I define an own attribute in the SOAP-API to use it in the update-function but without create it in the database?


EDIT: I've edited my problem-description because I've found out the following things:

I've tested the script with the soap-call for catalogCategoryInfo() on different locations to see if my own attributes will be returned or not. This is the resut:

  • Call script on the server with the magento-project: my own attributes are missing
  • Call script on my local server (XAMPP): returns the data with my own attributes
  • Call script on an other server: returns the data with my own attributes

At this morning I've called the script on my local server so my first attribute was there. Then I swiched to test on the server with the magento-project and there it didn't worked anymore (I thought only the second attribute didn't worked but it were both...)


SO THE QUESTION IS:
How can the server where the script with the soap-call is placed influence the returned values? Which server-configuration has this effect?

Was it helpful?

Solution

I don't know if the following one is the correct answer for the problem (my own solution was: testing the soap-call only from my local server), but I think it could be a solution for the problem.

I think the problem could have been caused by the php wsdl-caching. The tab "overview" in http://www.magentocommerce.com/magento-connect/wsdl-cache-flush.html describes that you can't clear the wsdl-cache by disabling and enabling the wsdl-cache in the magento-backend. This is because php has wsdl-cache-files (mostly in the /tmp-folder > see http://magento-quickies.alanstorm.com/post/25179411452/phps-wsdl-caching-files for further information).

I think when I was running the script on the server with the magento-project, the script used an old cached version of the wsdl-file where the field for the second attribute wasn't defined. So deleting the cached wsdl-files in the /tmp-folder (defined in php.ini) could solve such problems.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top