简体   繁体   中英

Dynamic web service design for multi-customer systems

I'm working on a project and I need to refactor my web services because they are going to be used by different customers. Problem is these different customers may want to send or receive some custom data according to their needs. I'll try to explain it with an example.

Say we have two web services for our customers,

  1. WS_GetUsers | Input: None | Output: List of {UserName, IsActive, Name, Surname}
  2. WS_GetUserInfo | Input: UserName | UserName, IsActive, Name, Surname

And we have two customers. Cust1 and Cust2 are using same web services. But Cust1 wants from us to change my WS_GetUsers service. Because they only want to see active users (where IsActive=1).

So, I want to keep serving only two services for these two customers. But I don't want to change my input/output parameters of the service. Because Cust2 didn't want to change anything about services, so I should not disturb them.

Meanwhile, Cust2 realized that they need to have another information, LastLoginDateTime which we do not store in our database. So, lets say we did some magical work and started to store that info. But same problem occured here, now I need to send that info as response for both services. But Cust1 should not be affected from that change.

For now, we used key-value pair arrays as input and output to solve that problem. But I wonder if there is a method or approach (or any advice from you guys) about web services that are used for multi-institutions/customers.

Note: This question is all about service i/o parameters. Changing business flow according to inputs is not an issue for now.

I think your case is perfect for OData web service. You can create endpoints and return IQueryable, and client side will be able to send queries, expand responses etc..

http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/create-an-odata-v4-endpoint

http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/using-select-expand-and-value

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM