【问题标题】:Magento SOAP WSDL JAVA - create productMagento SOAP WSDL JAVA - 创建产品
【发布时间】:2018-09-23 21:24:51
【问题描述】:

我是使用 magento api 的新手,所以我使用 Eclipse 生成类。

create -> new -> other -> WebService 客户端/放置 de magento api wsdl。

然后 Eclipse 为我创建类。

我可以使用 api 列出所有 catalog_products.list。

但我不知道如何使用 api“catalog_product.create”创建产品

我正在按照此文档创建产品,但 PHP 中只有示例。

https://devdocs.magento.com/guides/m1x/api/soap/catalog/catalogProduct/catalog_product.create.html

这是我的代码。

public void consumirWebService() throws Exception {
        BindingStub service = (BindingStub) new MagentoServiceLocator().getPort();
        String token = service.login("user", "password");
        Map<String, String>[] mapss = new Map[1];
        Map<String, String> mapProduto = new HashMap<String, String>();
        mapProduto.put("type", "virtual");
        mapProduto.put("sessionId", "1");
        mapProduto.put("set", "4");
        mapProduto.put("sku", "7622300243449");
        mapProduto.put("storeView", "1");
        mapProduto.put("name", "NOME PRODUTO");
        mapProduto.put("description", "descricao");
        mapProduto.put("short_description", "short description");
        mapProduto.put("weight", "1");
        mapProduto.put("status", "1");
        mapProduto.put("price", "100");
        mapProduto.put("visibility", "4");
        mapProduto.put("tax_class_id", "1");
        mapProduto.put("website_ids", "1");
        mapProduto.put("categories_ids", "1");
        mapss[0] = mapProduto;
        Object o = service.call(token, "catalog_product.create", mapss);
        System.out.println("ID" + o);
    }

我总是得到这个异常:

给出的数据无效。错误消息中的详细信息。

谁能帮帮我

【问题讨论】:

    标签: java api magento soap wsdl


    【解决方案1】:

    该示例应该足以了解您如何使用 SOAP 客户端创建内容。方法和类的名称都是一样的,只是语言不同。尝试在生成的 java 类中找到每个等价物。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-06
      • 1970-01-01
      相关资源
      最近更新 更多