【问题标题】:Trying to access the Magento SOAP API on Node.js尝试访问 Node.js 上的 Magento SOAP API
【发布时间】:2016-05-15 18:08:23
【问题描述】:

我正在尝试使用npm magento 访问Magento SOAP API (v 1.9.2.4)。但是data 始终是null

var express = require('express');
var app = express();
var MagentoAPI = require('magento');
var magento = new MagentoAPI({
  host: 'localhost',
  port: 8080,
  path: '/magento/api/xmlrpc/',
  login: 'mothership',
  pass: 'bvZ0k0B02pTjujN'
});

app.get('/', function (req, res) {
  res.send('Customers: ');
});

var magentoCallback = function(data) {
  console.log('Got data: ' + data);
  console.log(data);
};

magento.login(function(err, sessId) {
  if (err) {
    console.log("Error accessing Magento");
    console.log(err);
    console.log("Session ID: " + sessId);
    return;
  }
  console.log("Connected to Magento");
  magento.core.info(magentoCallback);
});

app.listen(3000, function () {
  console.log('Racing on port 3000');
});

【问题讨论】:

    标签: javascript node.js magento soap


    【解决方案1】:

    今天,我遇到了同样的问题,两个小时后我找到了解决方案。您需要将 magentoCallback 函数更改为:

    var magentoCallback = function(err, response) {
        if (err) {
            return console.log(err);
        }
    
        console.log("Result: ");
        console.log(response)
    };
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多