Java 如何在node.js中使用SOAP成功请求adwords url?
Adwords API没有node.js的客户端库。如本文所述,您可以在其他语言中使用SOAP工具包。所以,我也这么做了。我用了如下方法Java 如何在node.js中使用SOAP成功请求adwords url?,java,node.js,xml,soap,adwords-apiv201402,Java,Node.js,Xml,Soap,Adwords Apiv201402,Adwords API没有node.js的客户端库。如本文所述,您可以在其他语言中使用SOAP工具包。所以,我也这么做了。我用了如下方法 var soap = require('soap'); async function getLocation() { let wsdlURL = 'https://adwords.google.com/api/adwords/cm/v201809/LocationCriterionService?wsdl'; const url = 'https://adw
var soap = require('soap');
async function getLocation() {
let wsdlURL = 'https://adwords.google.com/api/adwords/cm/v201809/LocationCriterionService?wsdl';
const url = 'https://adwords.google.com/api/adwords/cm/v201809';
let Id = "1000004";
let LocationName = "Quebec";
var args = { request: {
"feilds":["Id", "LocationName", "CanonicalName", "DisplayType",
"ParentLocations", "Reach"],
"predicates":["LocationName","IN",LocationName]
}
};
soap.createClientAsync(wsdlURL).then((client) => {
console.log(client); //console 1
console.log(client.getLocation(args)); //console 2
return client.getLocation(args);
}).then((result) => {
console.log(result); //console 3
})
.catch((e)=> {
console.log(e)
});
}
对于控制台1,我得到
注意:XML脚本非常长。所以,我不能展示全部内容
对于控制台2,我得到:
TypeError:client.getLocation不是函数
我试图将java示例转换为node.js。如何转换此示例