7.2. Rest of RPC

In the previous section, we have gone through nuts and bolts of RPC. For some, its pattern may still bit fuzzy and to reinforce the concept we leave the rest of datastore calls as an exercise for readers.

Client still has SymbolDatabase calls in following three classes.

  • in.fins.client.action/SymbolAction.java

  • in.fins.client.action/DataGroupAction.java

  • in.fins.client.action/DataAction.java

Shift them to RPC with following steps.

  • define method in ISymbolService interface. Use method names - getSymbol(), getDataGroup() and getData() with proper parameters and return type.

  • define equivalent methods in ISymbolServiceAsync with a AsyncCallback as last parameter and return type as void.

  • implement the methods in SymbolService on server side.

  • invoke service methods from client

Client modules

Random and DateTimeFormat in SymbolDatabase throws runtime error on server as they are meant for client side coding as explained in Chapter - Model. On server side, you are free to use any Java class. So replace them with java.util.Random and java.text.SimpleDataFormat.

In the next chapter, we migrate to a RDBMS datasource from mock SymbolDatabase.

Forward Pointers

Deferred Binding - refer Coding Basics - Deferred Binding and Faq