Where do you put modified WSDL files for the API to override the core definitions?
سؤال
We've updated the standard WSDL definitions to support bundled product attributes for sku_type and price_type. I've tried putting the updated WSDL and WSI files in app/code/local/Mage/Catalog/etc/
, but Magento doesn't load them. I don't want to leave them in the core area, but that seems to be the only place I can get Magento to find them.
Any suggestions?
المحلول
You can have wsdl definitions in the local folder also.
What you need to do is to create a custom module. In your custom module you can add the files api.xml
, wsdl.xml
and wsi.xml
inside the etc
folder.
Your wsdl.xml
file should be taken into consideration when building the actual wsdl. Magento merges all wsdl.xml
files from all the modules that have one (same goes for api.xml
and wsi.xml
). These files are merged, so you don't need the full xml file from Mage_Catalog
model. You can add only the pieces you need, just make sure you keep the same path.
Here is a simple example. In wsdl.xml
from Mage_Catalog
there is this piece of code:
<definitions...>
<types>
<schema ...>
<complexType name="catalogProductEntity">
<all>
<element name="product_id" type="xsd:string"/>
<element name="sku" type="xsd:string"/>
<element name="name" type="xsd:string"/>
<element name="set" type="xsd:string"/>
<element name="type" type="xsd:string"/>
<element name="category_ids" type="typens:ArrayOfString"/>
<element name="website_ids" type="typens:ArrayOfString"/>
</all>
</complexType>
</schema>
</types>
</definitions>
And you want to add an other field to this type, all you have to do in your wsdl.xml file from your custom module is this:
<definitions...>
<types>
<schema ...>
<complexType name="catalogProductEntity">
<all>
<element name="custom_attribute" type="xsd:string"/>
</all>
</complexType>
</schema>
</types>
</definitions>
(add the attributes for the tags definitions and schema that I've replaced with '...').