Magento用肥皂v2创建类别 [英] Magento create category with soap v2
问题描述
我想使用网络服务请求(肥皂v2)来创建Magento中的类别. 我使用的是Magento 1.4.2.0,正如我所说的magentos soap api v2.
I want to crate categories in Magento with a webservice request (soap v2). I use Magento 1.4.2.0 and as I said the v2 of magentos soap api.
如果我发送请求,则会收到以下错误作为响应:
If I send the request I get the following error as response:
<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>103</faultcode>
<faultstring>Attribute "include_in_menu" is required.</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
问题在于,XML标签"include_in_menu"在请求中不可用. 如果我手动添加此标签,它将被忽略.
The problem is, that the xml tag "include_in_menu" is not available in the request. If I add this tag manually it will be ignored.
如果我不想使用肥皂v.1,该怎么办?
What can I do, if I don't want to use soap v.1?
问候LStrike
PS:这是我的要求
<?xml version="1.0" encoding="UTF-8"?><?xe.source ../../../Common/Data/login_response.xml#Envelope?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" media-type="text/xml"></xsl:output>
<xsl:template match="/">
<soapenv:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:urn="urn:Magento" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header></soapenv:Header>
<soapenv:Body>
<urn:catalogCategoryCreate soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<sessionId xsi:type="xsd:string">
<xsl:value-of select="soapenv:Envelope/soapenv:Body/urn:loginResponse/loginReturn"></xsl:value-of>
</sessionId>
<parentId xsi:type="xsd:int">
<xsl:value-of select="'3'"></xsl:value-of>
</parentId>
<categoryData xsi:type="urn:catalogCategoryEntityCreate">
<!--You may enter the following 19 items in any order-->
<!--Optional:-->
<name xsi:type="xsd:string">
<xsl:value-of select="'TestKategorie'"></xsl:value-of>
</name>
<!--Optional:-->
<is_active xsi:type="xsd:int">
<xsl:value-of select="'1'"></xsl:value-of>
</is_active>
<!--Optional:-->
<position xsi:type="xsd:int"></position>
<!--Optional:-->
<available_sort_by soapenc:arrayType="xsd:string[2]" xsi:type="ns1:ArrayOfString">
<item xsi:type="xsd:string">name</item>
<item xsi:type="xsd:string">price</item>
</available_sort_by>
<!--Optional:-->
<custom_design xsi:type="xsd:string"></custom_design>
<!--Optional:-->
<custom_design_apply xsi:type="xsd:int"></custom_design_apply>
<!--Optional:-->
<custom_design_from xsi:type="xsd:string"></custom_design_from>
<!--Optional:-->
<custom_design_to xsi:type="xsd:string"></custom_design_to>
<!--Optional:-->
<custom_layout_update xsi:type="xsd:string"></custom_layout_update>
<!--Optional:-->
<default_sort_by xsi:type="xsd:string"><xsl:value-of>name</xsl:value-of></default_sort_by>
<!--Optional:-->
<description xsi:type="xsd:string"></description>
<!--Optional:-->
<display_mode xsi:type="xsd:string"></display_mode>
<!--Optional:-->
<is_anchor xsi:type="xsd:int"></is_anchor>
<!--Optional:-->
<landing_page xsi:type="xsd:int"></landing_page>
<!--Optional:-->
<meta_description xsi:type="xsd:string"></meta_description>
<!--Optional:-->
<meta_keywords xsi:type="xsd:string"></meta_keywords>
<!--Optional:-->
<meta_title xsi:type="xsd:string"></meta_title>
<!--Optional:-->
<page_layout xsi:type="xsd:string"></page_layout>
<!--Optional:-->
<url_key xsi:type="xsd:string"></url_key>
<!-- selbst definierte Felder -->
<include_in_menu xsi:type="xsd:int">1</include_in_menu>
</categoryData>
<storeView xsi:type="xsd:string">
<xsl:value-of select="'default'"></xsl:value-of>
</storeView>
</urn:catalogCategoryCreate>
</soapenv:Body>
</soapenv:Envelope>
</xsl:template>
</xsl:stylesheet>
推荐答案
您有4种方法.
第一-更改 应用程序/代码/核心/法师/目录/etc/wsdl.xml 在第188行之后,添加
First - Change app/code/core/Mage/Catalog/etc/wsdl.xml after line 188 add
<element name="include_in_menu" type="xsd:int" minOccurs="0" />
第二个-更改Api模型的逻辑 应用/代码/核心/法师/目录/模型/类别/Api/V2.php 在代码中将此属性添加到新的 对象.
Second - Change logic of Api Model app/code/core/Mage/Catalog/Model/Category/Api/V2.php in code add this attribute to the new object.
第三-向magento报告错误,并 等待它解决(1-2附近) 月)
Third - Report bug to the magento and wait until it resolved (near 1-2 month)
第四-至少可以创造你 您只是覆盖的扩展名 应用程序/代码/核心/法师/目录/etc/wsdl.xml 将您的参数添加到WSDL文件中, 在您的扩展中更改API模型 用于其他参数.
Fourth - And least create you extension where you just override app/code/core/Mage/Catalog/etc/wsdl.xml add your paramters to the WSDL file, change API model in your extensions for additional parameters.
我的提案使用第四种方式.
My proposal use 4th way.
这篇关于Magento用肥皂v2创建类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!