1

我正在尝试从 c# 对 Magento 进行编程。在第一步中,我将服务引用添加到 Visual Studio 中的项目。但我没有 MagentoService 类。当我下载 wdsl 文件并通过 Visual Studio 命令行中的 wsdl.exe 转换它时,我就有了它。因此,在服务引用的情况下,我的代码如下所示:

MagentoSer.Mage_Api_Model_Server_HandlerPortTypeClient client = new MagentoSer.Mage_Api_Model_Server_HandlerPortTypeClient();
var session= client.login("id", "password");
client.call(session, "catalog_category.tree", null);
client.endSession(session);

一切正常。但是当我尝试使用

MagentoSer.Mage_Api_Model_Server_HandlerPortTypeClient client = new MagentoSer.Mage_Api_Model_Server_HandlerPortTypeClient();
var session= client.login("id", "password");
client.call(session, "product_stock.list", "qqaz");
client.endSession(session);

出现异常“反序列化操作'call'的回复消息正文时出错”指定的类型未被识别:name='Map',namespace='<a href="http://xml.apache.org/xml-soap " rel="nofollow noreferrer">http://xml.apache.org/xml-soap', at ."}

从 PHP 测试时,一切正常。我发现这两篇文章 http://codeblow.com/questions/php-web-service-in-c-invoke-function-returns-null/ C# 中的 PHP Web 服务:Invoke() 函数返回 null 但我不能把握大局。

那些关于对象参数的

public object call(string sessionId, string resourcePath, object args);

或者关于函数的输出?还有一件事情。在网上搜索时,我发现了使用奇怪数组(如 complexFilter)的代码示例(Magneto 帮助)。如果我通过 Visual Studio 连接到 wsdl 文件,如何获取它们?这是在 Magento 管理员权限中向我公开它们吗?

最好的祝福

普热梅斯瓦夫·斯坦尼斯谢夫斯基

4

1 回答 1

0

在 Magento 管理面板中尝试打开 WSI 合规模式

于 2012-10-17T13:33:23.400 回答