service call approach in n-tier environment? RRS feed

  • Question

  • Hello, how would you handle a scenario where you get the data for your application via a web service?  Would you put the web service calls:

    * in the bll
    * in the dall
    * in a specialized service layer

    Thursday, November 6, 2014 12:44 AM

All replies

  • Depends...what are you trying to do?


    Thursday, November 6, 2014 1:34 PM
  • 1 example would be a e-commerce website that calls a web service that is managed by a different team in the company to get data to display in the website
    Thursday, November 6, 2014 5:41 PM
  • Call your web services from a business layer if the said web service is participating on in processing complex business rules, transforming data, applying policies, Workflows and for validation.

    Call your web services from a Data Access layer if the said web service is participating in two or more operation of CRUD or one of your application data access operation is depends on the above web service or the web service is participating on transaction

    Call your web services from a Presentation  layer if you are just  feeding the data with a minimal transformation to the UI.

    Call your web services from a Service layer/Tier if two or more web services are participating on a single use case.

    For your given scenario, you may need data transformation, apply rules (Discounts) and aggregation hence I would recommend you to go ahead with Business Layer.

    Lingaraj Mishra

    Friday, November 7, 2014 1:24 PM
  • Whilst I agree with Lingaraj's response, I would add caution that this sounds like you'd be assuming a RPC style call. What happens if the call to the web service is slow, or doesn't work?


    Friday, November 7, 2014 1:48 PM
  • Though you have not provided enough information here on your current architecture, but I think it is a fair to assume that you have pretty straight system - presentation --> BLL --> DAL --> Data Store. If web service call requirement is mainly for look up and final intention is to orchestrate the lookup call with DAL response. I think you can take up standard approach and create a infrastructure layer - which will manage calls to web service.
    Tuesday, November 25, 2014 9:57 PM