Для начала вам нужно будет построить мыло ввода XML, как определено в WSDL т.е. параметры должны быть преобразованы к XML в определенном формате, то URL Fetch потребности, которые будут использоваться для вызова SOAP WS , Образец, чтобы получить обменный курс
function WS_Currency() {
var soapIn = XmlService.parse(
'<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/soap/envelope/"></soap12:Envelope>'); // We cannot build the XML from scratch as GAS XML does not allow multiple NS for root
var soapEnv = soapIn.getRootElement();
//Build your soap message
var soapNS = soapEnv.getNamespace("soap12");
var apiNS = XmlService.getNamespace("http://www.webserviceX.NET/");
var soapBody = XmlService.createElement("Body", soapNS);
var ConversionRate = XmlService.createElement("ConversionRate", apiNS);
var FromCurrency = XmlService.createElement("FromCurrency", apiNS).setText('USD');
var ToCurrency = XmlService.createElement("ToCurrency", apiNS).setText('GBP');
ConversionRate.addContent(FromCurrency);
ConversionRate.addContent(ToCurrency);
soapBody.addContent(ConversionRate);
soapEnv.addContent(soapBody);
// Set the http options here
var options =
{
"method" : "post",
"contentType" : "text/xml; charset=utf-8",
"payload" : XmlService.getRawFormat().format(soapIn),
"muteHttpExceptions" : true
};
// Call the WS
var soapCall= UrlFetchApp.fetch("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL", options);
// Extract the output, yeah this is the only way we need to traverse the received XML :(
var cRate = XmlService.parse(soapCall.getContentText()).getRootElement().getChild("Body", soapNS).getChild("ConversionRateResponse", apiNS).getChild("ConversionRateResult", apiNS).getValue();
Logger.log(cRate);
}
какой тип веб-сервиса SOAP или REST? - обновите вопрос –
Это веб-сервис SOAP –