使用 node-soap 连接 Bing Ads API

Dpk*_*Dpk 4 soap bing node.js node-soap bing-ads-api

我正在尝试使用 node-soap 连接到 bing ads 肥皂 api。我已按照 bing文档中的建议创建了请求。但每次我尝试连接时,响应都会显示无效凭据(错误代码 - 105)消息 - 身份验证失败。提供的凭据无效或帐户处于非活动状态。

我能够使用 bing 提供的示例 C# 代码来验证 API。因此,很明显凭证/令牌工作得很好。

有没有办法通过我的方法或我的节点代码来识别问题。

soap.createClient(url, function (err, client) {
    if (err) {
        console.log("err", err);
    } else {
        client.addSoapHeader({
            'AuthenticationToken': '<AuthenticationToken>',
            'DeveloperToken': '<DeveloperToken>',
            'CustomerId': '<CustomerId>',
            'CustomerAccountId': '<CustomerAccountId>',
        });        
        client.SubmitGenerateReport(args, function (err, result) {
            if (err) {
                console.log("err", err.body);
            } else {
                console.log(result);
            }
        });
    }
});
Run Code Online (Sandbox Code Playgroud)

PS:Bing 文档很糟糕。堆栈溢出万岁!

rad*_*dyz 5

您需要在标头中的每个键前面加上 前缀tns,例如:tns:AuthenticationToken