2012-07-03 137 views
3

我有一个客户想要使用Magento的Web服务API创建和更新客户。使用API​​,我们可以使用V1或V2 API轻松操纵系统定义的属性 - 名字,姓氏等。我们很高兴去那里。Magento Enterprise 1.12 - 从V2 API访问客户自定义属性

这就是它粘滞的地方 - 本网站使用Magento Enterprise 1.12,并且我们添加了一些自定义客户属性,用于将Magento客户与其外部系统上的CRM数据关联起来。使用V1 API,我可以完全访问自定义属性。但是,V2 API不会公开它们。由于调用者来自.NET,我相信他需要使用V2 API。

使用调试器跟踪代码,我发现V2代码获取所有属性数据,然后在生成Web服务响应时删除所有自定义数据。我尝试将这些属性添加到客户(Mage/Customer/etc /)WSDL和WSI文件中,但这并没有成功。

任何人都可以给我一个指针,我应该怎么做才能公开客户属性?

格雷格

+0

在更深的挖掘,我现在看到所有你需要做的,添加API V2访问自定义属性是附加字段添加到客户wsdl.xml&wsi.xml文件。新问题是我无法找出覆盖核心wsdl的正确方法。我已经尝试在app/code/local/customer/etc/wsdl.xml中放置修改后的副本,但这些更改似乎无法覆盖app/code/core/customer/etc/wsdl.xml中的wsdl。有什么想法吗?我担心在核心中修改wsdl,但在这种情况下我可能必须这样做。 – GregC

回答

2
  1. 创建一个新模块
  2. Your_Module/etc/wsdl.xmlwsi.xml在同一节点中添加新的属性,如Mage_Customer wsdl.xmlwsi.xml
  3. Magento的合并所有wsdl.xmlwsi.xml文件一起
+0

谢谢亚历克斯 - 我做到了这一点,它运作得非常好。 – GregC

0

下面是我使用的wsdl.xml文件的示例d将customer_number添加到API。

<?xml version="1.0" encoding="UTF-8"?> 
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" 
name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}"> 
    <types> 
     <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento"> 
      <complexType name="customerCustomerEntity"> 
      <all> 
       <element name="customer_number" type="xsd:string" minOccurs="0" /> 
      </all> 
      </complexType> 
     </schema> 
    </types> 
</definitions>