Problems with multiple items in a wsdl soap request

I'm having trouble getting multiple items in a wsdl soap request. When I directly convert directly to webservicex, I get the current currency conversion. When I try to do the same in a script application, it always returns “0” for speed. What am I missing here?

function getCurrencyConversion2(){ var fromCurr = "USD"; var toCurr = "AUD"; var wsdl = SoapService.wsdl("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"); Logger.log(wsdl.getServiceNames()); var currencyService = wsdl.getService("CurrencyConvertor"); Logger.log(currencyService.getOperationNames()); //var convertOp = currencyService.getOperation("ConversionRate");  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]); return; } 
+4
source share
1 answer

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.

+5
source

Source: https://habr.com/ru/post/1445663/


All Articles