Hi,
During my career I have never had the opportunity to write X++ code that consumes an external web services...
I am trying to get exchange rates from the Swedish Riksbank (the central bank of Sweden) through their web service API (https://swea.riksbank.se/sweaWS/docs/api/index.htm ).
I add a service reference in AX and enters the URL to the wsdl location (https://swea.riksbank.se/sweaWS/wsdl/sweaWS.wsdl ). Then I create a class with a method which looks something like this:
public static server Exchrate getRate()
{
netCurrencyService.SweaWebServicePortTypeClient soapClient;
ExchRate conversionrate;
str rates[2];
;
try
{
new InteropPermission(InteropKind::ClrInterop).assert();
soapClient = new netCurrencyService.SweaWebServicePortTypeClient();
rates[1] = "SEKUSDPMI";
rates[2] = "SEKGBPPMI";
conversionrate = soapClient.getLatestInterestAndExchangeRates("en", rates);
CodeAccessPermission::revertAssert();
return conversionrate;
}
catch(Exception::CLRError)
{
throw error(AifUtil::getClrErrorMessage());
}
}
My problem is that the code does not compile. The call "soapClient.getLatestInterestAndExchangeRates("en", rates)" indicates that argument 2 ("rates") is incorrect. If I enter a string instead the compiler says that the class netCurrencyService.SweaWebServicePortTypeClient doesn't include this function ("getLatestInterestAndExchangeRates"?).
Any suggestions?