我目前正在尝试访问我的 magento 商店的 SOAP API 但没有成功。我在后端创建了一个 soap 用户和 Angular 色,并通过 xmlrpc 登录测试了它们。 同源策略不是问题。我通过 url myshop.com/api/?wsdl 获取 wsdl
我试过了jquery soap client :
$.soap({
url: 'http://my-shop.de/api/',
method: 'login',
data: {
username:'soap_username',
apiKey:'soap_userpass'
},
success: function (soapResponse) {
alert("yes!!");
},
error: function (SOAPResponse) {
alert(SOAPResponse.toString());
}
})
返回 404,我不明白为什么。
另外我试过javascript soap client :
var url = 'http://myshop.de/api/';
var pl = new SOAPClientParameters();
pl.add("username", 'soap_username');
pl.add("apiKey", 'soap_userpass');
SOAPClient.invoke(url, "login", pl, true, HelloTo_callBack);
function HelloTo_callBack(r) {
alert(r.toString());
};
返回 500 内部服务器错误。再一次,我不知道这里出了什么问题。 谁能给我一个关于我所缺少的东西的提示?
感谢任何帮助或提示,谢谢!
最佳答案
好的,找到问题了! 这是维护模式。甚至我的 ip 也被列入白名单,我可以正常浏览商店和后端,不知何故 soap api 调用搞砸了。所以对我来说工作代码是:
$.soap({
url: 'http://my-shop.de/api/?wsdl',
method: 'login',
data: {
username:'soap_username',
apiKey:'soap_userpass'
},
success: function (soapResponse) {
alert("yes!!");
},
error: function (SOAPResponse) {
alert(SOAPResponse.toString());
}
})
(注意更改的 URL)
关于javascript - 通过 JavaScript 访问 Magento SOAP API : What am i doing wrong?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19987776/