I found an example on how to call a webservice with Google drive scripts here: https://developers.google.com/apps-script/articles/soap_geoip_example
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;
}
However this uses the SoapService which is deprecated. the documentation says I should use UrlFetchApp Converting the input xml is easy. But can anyone tell me how to call a webservice with the UrlFetchApp?
See Question&Answers more detail:os