Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/321.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
Java 如何在node.js中使用SOAP成功请求adwords url?_Java_Node.js_Xml_Soap_Adwords Apiv201402 - Fatal编程技术网

Java 如何在node.js中使用SOAP成功请求adwords url?

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

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://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。如何转换此示例