Magento Api Methods Problems -
Magento Api Methods Problems -
i overwrite next api "mage_catalog_model_product_api_v2". there, i've added few new methods.
now have tried on soapv2 interface "old" method phone call (the "create" method example). there got next error message: "fatal error: uncaught soapfault exception: [3] invalid api path. in...".
do need list methods etc. api.xml "create", "update" in the?
here's code... :)
api.xml
<connector_category translate="title" module="connector"> <model>mycompany_mymodel_model_catalog_category_api</model> <title>category api</title> <methods> <removeallcategories translate="title" module="connector"> <title>retrieve category id name</title> <acl>catalog/category</acl> </removeallcategories> </methods> </connector_category>
wsdl.xml
<message name="catalogcategoryremoveallcategoriesrequest"> <part name="sessionid" type="xsd:string" /> <part name="product" type="xsd:string" /> <part name="productidentifiertype" type="xsd:string" /> </message> <message name="catalogcategoryremoveallcategoriesresponse"> <part name="result" type="xsd:boolean" /> </message> <porttype name="{{var wsdl.handler}}porttype"> <operation name="catalogcategoryremoveallcategories"> <documentation>remove product assignments category</documentation> <input message="typens:catalogcategoryremoveallcategoriesrequest"/> <output message="typens:catalogcategoryremoveallcategoriesresponse"/> </operation> </porttype> <binding name="{{var wsdl.handler}}binding" type="typens:{{var wsdl.handler}}porttype"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="catalogcategoryremoveallcategories"> <soap:operation soapaction="urn:{{var wsdl.handler}}action"/> <input> <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input> <output> <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <service name="{{var wsdl.name}}service"> <port name="{{var wsdl.handler}}port" binding="typens:{{var wsdl.handler}}binding"> <soap:address location="{{var wsdl.url}}"/> </port> </service>
config.xml
<global> <models> <mycompany_mymodule> <class>mycompany_mymodule_model</class> <resourcemodel>mycompany_mymodule_resource</resourcemodel> </mycompany_mymodule> <mycompany_mymodule_resource> <class>mycompany_mymodule_model_resource</class> </mycompany_mymodule_resource> <catalog> <rewrite> <category_api_v2>mycompany_mymodule_model_catalog_category_api_v2</category_api_v2> </rewrite> </catalog> </models> </global>
mycompany/mymodule/model/catalog/category/api/v2.php
class mycompany_mymodule_model_catalog_category_api_v2 extends mage_catalog_model_category_api_v2 { /** * @param $productid * @param null $identifiertype * @return bool */ public function removeallcategories($productid, $identifiertype = null) { $product = mage::getmodel('catalog/product')->load($productid); $categoryids = $product->getcategoryids(); foreach ($categoryids $categoryid) { $this->removeproduct($categoryid, $productid, $identifiertype); } homecoming true; } }
api
Comments
Post a Comment