// Instantiate a Service component // Configuration taken from associated External Resource exchange as CurrencyExchangeService = CurrencyExchangeService() // Invoke the "getRate" operation rate = exchange.getRate(from: "USD", to: "EUR")
If you use the default constructor of a *Service component, it reads the configuration values from the associated External Resource.
// Build new WebService configuration:
wsConfig = Fuego.WebServices.Configuration()
exchangeEndPoint = HttpEndpoint("http://localhost:8080/webservices/CurrencyExchange")
wsConfig.endpoint = exchangeEndPoint
// Instantiate a Service component, passing a configuration
// object and ignoring the associated External Resource
exchange as CurrencyExchangeService = CurrencyExchangeService(wsConfig)
// Invoke the "getRate" operation
rate = exchange.getRate(from: "USD", to: "EUR")
Refer to the documentation of Fuego.WebServices.Configuration
component for more details.
do
// Invoke service
exchange as CurrencyExchangeService = CurrencyExchangeService()
rate = exchange.getRate(from: "USD", to: "EUR")
on soapFault as SoapFaultException
logMessage "SOAP fault caught: ["+ soapFault.faultCode+"] "
+ soapFault.faultString
logMessage "Fault message:"+generateXmlFor(soapFault)
// ...
on ex as Exception
logMessage "Non-SOAP exception calling Web Service "+ex
// ...
end