Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 使用节点soap连接Bing Ads API_Node.js_Soap_Bing_Node Soap_Bing Ads Api - Fatal编程技术网

Node.js 使用节点soap连接Bing Ads API

Node.js 使用节点soap连接Bing Ads API,node.js,soap,bing,node-soap,bing-ads-api,Node.js,Soap,Bing,Node Soap,Bing Ads Api,我正在尝试使用节点soap连接到bing ads soap api。我已经按照bing中的建议创建了请求。但每次我尝试连接响应时,都会显示无效凭据(错误代码-105)消息—身份验证失败。提供的凭据无效或帐户处于非活动状态 我能够使用bing提供的示例C#代码对API进行身份验证。因此,很明显,凭证/令牌工作得非常好 是否有办法通过我的方法或在我的节点代码中识别问题 soap.createClient(url, function (err, client) { if (err) {

我正在尝试使用节点soap连接到bing ads soap 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);
            }
        });
    }
});
soap.createClient(url,函数(err,客户端){
如果(错误){
console.log(“err”,err);
}否则{
client.addSoapHeader({
“AuthenticationToken”:“,
“DeveloperToken”:“,
'客户ID':'',
“CustomerAccountId:”,
});        
client.SubmitGenerateReport(参数,函数(错误,结果){
如果(错误){
console.log(“err”,err.body);
}否则{
控制台日志(结果);
}
});
}
});

PS:Bing文档很糟糕。万岁

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

您是否可以使用它,是否介意分享方法?谢谢你,还是@Christoph让它工作了,你介意现在分享吗?@amit,不幸的是我没有。我现在正在使用其他工具来访问api,因为我主要需要它进行分析。@Christoph,很抱歉延迟了响应。是的,我成功了。当我将我的请求xml与WcfTestClient生成的请求xml进行比较时,我发现我的请求格式不正确。在修复时,我能够调用API。我希望这能帮上忙:)谢谢,我把问题的答案贴在上面,让它工作起来了。