Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. 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.

    Code Block
    languagec#
    linenumberstrue
    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.

     

  2. After Building your Class Library you need to add genrated assembly into  Aptify.Services.FrameWork bin folder.

  3. 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..In Controller section there are four tabs available.

 General Tab: 

Name: Controller Name

dotnet Class Plugin:   is dotnet Class Plugin  Is class responsible for servicing actual request and getting data.

 

Image Added

Controller Genrated Classes Tab:

Once you saved the Controller record , the Controller Genrated Classes will be automatically generated.

Image RemovedController Routes Tab:

Controller route routes  defines how URL looks like how to access controller endpoint is defined here.You can add multiple controller routes. it has 

Name:  Name of Controller routeRoute

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 for Aptify SOA.

Route Help Text: It gives summary information about the controller and parameters thats it expects. These are standard .net /// comments. after setting Once set these comments  it will displayed automatically displayed in help page. 

Image Added

 

Image Removed 

Controller Route Routes Http Method Tab: 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 Tab: defines Defines how the controller can be accessed by defining path parts. It will correlate the URl  how  user will access URL.

...

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.

      4. Next step is add record in Controller Configuration under web service in Aptify.

Image Added

           Name: Controller Configuration Name

           Controller: Select Controller name that you have generated from list.

           Authorization Plugin: you can select autherization plugin if you need to provide autherization.

   Caching Policy:  Currently Aptify Supprots two types of cache policy. Nocaching for not to support cache policy and YearCaching whcih is along with timecache policy.You can set caching policy attribute      by passing number of year.

           Require Authentication: If checked it means it require valid authentication token for SOA. if not then controllers can be called without any credenticals.

           Allow Anonymous: If checked it allows anonymous user to access end point.

        5. Now you need to add record in Controller Configuration Collection under Controller Configuration Tab. Controller Configurations are grouped together in Controller Configuration Collections.

Image Added

 

            If caching policy  and autherization plugin is defined for controller configuration it will be override by policy defined in controller configurations.

       6. Now you need to set service application in web service for that controller collection. For this you add record of Controller Configuration Collections that you have created.

        Image Added