You will like this one. He also put me down for a while.
The problem is that the xmlns attribute is case sensitive. You added it as http://www.webservicex.net/ when the correct version is http://www.webservicex.net/ . Check out X.NET at the end.
The next improved version should work fine (it writes XML from 0.9602 as an exchange rate).
function getCurrencyConversion2(){ var fromCurr = "USD"; var toCurr = "AUD"; var wsdl = SoapService.wsdl("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"); var currencyService = wsdl.getService("CurrencyConvertor"); var param = Xml.element("ConversionRate", [ Xml.attribute("xmlns", "http://www.webserviceX.NET/"), Xml.element("FromCurrency", [fromCurr]), Xml.element("ToCurrency", [toCurr]) ]); var result = currencyService.invokeOperation("ConversionRate", [param]); Logger.log(result.toXmlString()); return; }
This was painful due to the complexity of SOAP and the fact that this service did not return a valuable error message.
source share