In-progress
Introduction
Aptify has developed a new functionality to drop a new custom end points that will be addressed by URI through SOA. It will allow customers to develop there own end point as per there requirement.
Below are the steps to create your own end points in Aptify.
Step-by-Step Guide For Creating Controller
Create a new Class Library to add a controller and save in Aptify code base like "../Main/Aptify.Services/Framework/Endpoints/Implementations". you need to add Aptify.servicesFramework dll as reference in your class library. Below is sample code to demonstrate on how to pass parameter and display parameter value.
using System; using Aptify.Services.Framework.Endpoints; namespace ParamDemo { public class TestController : Aptify.Services.Framework.Endpoints.ServiceController { public override Aptify.Services.Framework.Endpoints.ServiceResponse ProcessRequest(Aptify.Services.Framework.Endpoints.ServiceRequestContext context) { string param1 = (string)context.ServiceParameters["param1"]; //to pass parameter1 to service request ServiceResponse response = new ServiceResponse(); response.Content = new StringContent("Parameter1 having value:" + param1); // response display to client return response; } } }
In the above code ServiceRequestsContext object is having information about request i.e. ControllerName, cookies,Headers, httpmethod,query parameter,AuthenticatedContext, service parameter. Service parameters are non literal values that are defined in route. miscProperties are used in Autherization plugin to put the results of parsing into dictionary and provide result to service request.
ServiceResponse object provide information about response content. After building above class library you need to copy the assembly and add the reference in object repository in Aptify.- In Aptify you should put the controller into Object Repository under services packages.
3. Next step is to add controller definition. Create a new record in Controller located under web service of aptify. Provide Name and dotnet class Plugin as shown below.
Name: Controller Name
dotnet Class Plugin: is class responsible for servicing actual request and getting data.
Once you saved the Controller record , the Controller Genrated Classes will be automatically generated.
Controller route defines how URL looks like how to access controller endpoint is defined here.You can add multiple controller routes.
Name: Name of Controller route
Route Regular Expression: Route Regular expression are genrated by entity plugin for controller route.You need not to set it manually.It is used internally in SOA.
Route Help Text: It gives summary information about the controller and parameters thats it expects. These are standard .net /// comments. after setting these comments it will automatically displayed in help page.
Controller Route Http Method: You can select any standard http method defined in list.There are seven types of standard http method available in aptify. DELETE,GET,HEAD, OPTIONS,POST,PUT and TRACE..
Controller Route Path Parts:defines how the controller can be accessed by defining path parts. It will correlate the URl how user will access URL.
Type: it will be any data type string, int, boolean etc.
Value: It may be part value or variable value. for example in above ParamDemo is part value which will be actual displayed in URI. but param1 is variable value which will be replaced by string variable in URl.
Is Literal: if checked then URL expect the value defined above.if not checked then value will be variable value.
Is Optional: if checked for part then value will be optional in the URI. But Is Optional checking should be logical. URI will be invalid if we checked Is Optional option for value but deselect for variable value.