0
我目前正在使用Google Apps脚本来调用简单的SOAP服务调用。但是,我不断收到错误。有没有人有我可以使用的例子或可能看到我的代码有什么问题?我的代码如下:使用Google Apps脚本的SOAP服务呼叫产生错误
function onOpen()
{
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var myValue = Browser.inputBox("Enter an IP address to trace:");
var b1Range = sheet.getRange("B1");
b1Range.setValue(myValue);
determineCountryFromIP(myValue);
}
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;
}