What is your suggested solution for the following requirement?

  • 8 April 2014
  • 1 reply
  • 0 views

Badge +4

Hello,

 

Could you please read through the next few paragraphs and give your advice on how to implement the requirement described below. I created this using K2 Connect and that was easy enough but now I want to achieve the same goal accessing the data through a webservice.

 

Requirement:

  1. I want to create a rather simple SmartForm showing the exchange rate between two currencies
  2. The exchange rates are stored in SAP and they only convert 'foreign' currencies to the same baseline currency: EUR
  3. So if we want to retrieve the exchange rate between two 'foreign' currencies we have to retrieve the two intermediate exchange rates via a webservice made available by SAP and then combine them into the final exchange rate: GBPtoUSD = GBPtoEUR / USDtoEUR

Using the "Endpoints WCF" ServiceObject I can access the data however the way I see it now I would need to create a SmartObject method doing loads of sequential calls:

  1. Serialize ExchangeRateInputObject1 (GBPtoEUR) and store the result in a smartObject property
  2. Access the webservice using the object and store the result in a smartObject property
  3. Deserialize the ExchangeRateOutputObject1 (GBPtoEUR) and store the result in a smartObject property
  4. Serialize ExchangeRateInputObject2 (USDtoEUR) and store the result in a smartObject property
  5. Access the webservice using the object and store the result in a smartObject property
  6. Deserialize the ExchangeRateOutputObject2 (USDtoEUR) and store the result in a smartObject property
  7. Call a ServiceObject method that calculates the final rate and store the result in a smartObject property

This required the creation of an additional 'calculation' serviceObject, a bunch of 'storage' smartObject properties and doesn't feel like a very good solution. Ideally I would like to be able to encapsulate all those operations into a single method call having no impact on the SmartObject structure.

 

 


1 reply

Badge +8

If it were me, I would write a web service or endpoint assembly with a conversion method that accepted three parameters, e.g. amount, fromCurrency, and toCurrency.  Then put all the logic of talking to other business systems in that method.  This way your SmartObject just has a single method with a few parameters and returns the single value you want, rather then creating a mess of SmartObjects and properties in the process.

 

SmartObjects are a good tool to integrate with other business systems, but you should be careful about trying to make them do too much.

Reply