我發現瞭如何調用web服務與谷歌在此驅動腳本的例子:https://developers.google.com/apps-script/articles/soap_geoip_example如何將已過時SoapService調用轉換爲新的UrlFetchApp
function determineCountryFromIP(ipAddress) {
var wsdl = SoapService.wsdl("http://www.webservicex.net/geoipservice.asmx?wsdl");
var geoService = wsdl.getGeoIPService();
var param = Xml.element("GetGeoIP", [
Xml.attribute("xmlns", "http://www.webservicex.net/"),
Xml.element("IPAddress", [
ipAddress
])
]);
var result = geoService.GetGeoIP(param);
return result.Envelope.Body.GetGeoIPResponse.GetGeoIPResult.CountryCode.Text;
}
然而,這使用SoapService至極已經過時了。該文檔說我應該使用UrlFetchApp 轉換輸入xml很容易。但誰能告訴我如何使用UrlFetchApp調用Web服務?
用'google-apps-script'代替這個問題而不是'google-drive -sdk'。 –