Mayank Pandya
Mayank Pandya

Reputation: 1623

How to call rpc service method from another rpc service?

There is two different GWT-RPC services.

  1. TaxService which contains method TaxDto getTax(ProductDto product);
  2. ProductService which contains method `Double getTotalWithTax(ProductDto product);

I want to call getTax() method from getTotalWithTax() how can I do this?

Upvotes: 0

Views: 481

Answers (1)

user1258245
user1258245

Reputation: 3639

To call getTax() on the server side, create an instance of TaxServiceImp that is accessible to getTotalWithTax(ProductDto product); Call the method from there.

    public class ProductService Impl extends XsrfProtectedServiceServlet{

         TaxServiceImp taxServImpInstance = new TaxServiceImp();

         Double getTotalWithTax(ProductDto product){

             TaxDto taxDtoInstance = taxServImpInstance.getTax();
             //process your data and return what you need

             return myDouble;

         }

    }

Upvotes: 3

Related Questions