【问题标题】:Connecting Bing Ads API using node-soap使用 node-soap 连接 Bing Ads API
【发布时间】:2017-06-16 13:28:20
【问题描述】:

我正在尝试使用 node-soap 连接到 bing ads soap api。我已经按照 bing documentation 中的建议创建了请求。但是每次我尝试连接响应时都会显示无效凭据(错误代码 - 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);
            }
        });
    }
});

PS:必应文档很烂。万岁 Stackoverflow!

【问题讨论】:

  • 你有没有让它工作,你介意分享一下吗?谢谢
  • 是你,还是 @Christoph 让它工作了,你介意现在分享吗?
  • @amit,不幸的是我没有。我现在正在使用其他工具来访问 api,因为我主要需要它来进行分析。
  • @Christoph,抱歉回复延迟。是的,我得到了它的工作。当我将我的请求 xml 与使用 WcfTestClient 生成的请求 xml 进行比较时,我发现我的请求格式不正确。在修复该问题时,我能够调用 API。我希望这会有所帮助:)
  • 谢谢,我设法让它与发布到这个问题的答案一起工作。

标签: node.js soap bing node-soap bing-ads-api


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-28
    相关资源
    最近更新 更多