【发布时间】: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