-
Notifications
You must be signed in to change notification settings - Fork 21
4 Extending
To extend the API functionality and create new controllers, follow the steps below:
1 - Setup and activate your AIF Inboud port for the service you want to wrap, and copy the WSDL URI.
2 - On Visual Studio, add a Service Reference using the WSDL URI from your AIF service.
3 - Right-click on Controllers folder, select Add -> Controller, choose "Web API 2 Controller - Empty" and name it as "ExpenseController"
4 - Replace the default code (blank class) by this sample:
5 - Rebuild your project, deploy and open the new URL
https://<your-webapp-url:port>/expense/{expense-number}
GET
https://localhost:44300/expense/000023
To add Cache functionality on controller operations, only two steps are required. First add the reference to the filters namespace on your controller class:
using AxaptaApiApp.Filters;
Then, add the attribute [CacheFilter]
on top of you method declaration:
[CacheFilter]
public async Task<IHttpActionResult> Get([FromUri] string expNumber) { ... }
NOTE: Use cache carefully. For more information, check the MemoryCache class documentation.