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.  

     

    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.

    After Building your Class Library you need to add genrated assembly into  Aptify.Services.FrameWork bin folder.
    In Aptify you should put the controller into Object Repository  under services packages.

 

 

 32. Next step is to add controller definition. Create a new record in Controller  located  under web service of aptify.In Controller section there are four tabs available.

 General Tab: 

  • Name: Controller Name
  • dotnet Class Plugin: dotnet Class Plugin  Is class responsible for servicing actual request and getting data.

 

Controller Genrated Classes Tab:

...

Controller routes  defines how URL looks like and how to access controller endpoint.You can add multiple controller routes. Field are  

  • Name:  Name of Controller Route
  • Route Regular Expression:  Route Regular expression are generated by entity plugin for controller route.You need not to set it manually.It is used internally for Aptify SOA.
  • Route Help Text: It gives summary information about the controller and parameters expects from endpoint. These are standard .net /// comments. Once set these comments will displayed automatically in help page. 

 

 

Controller 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 how the controller can be accessed by defining path parts. It will correlate the URl access by user.

  • 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 it's checked then URL expect the value defined above.if it's not checked then value is equal to variable value.
  • Is Optional: By default it's unchecked for the 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.

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

...

  •  

...

  • 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

...

  • Suppotts two types of cache policy. Nocaching for not to support cache policy and YearCaching

...

  • which 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.

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

...

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

       6 5. 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.

        

   

Now you can execute genrated URI on browser.

Sample Endpoint

For above example as we set cache policy as 'No-caching' There will be no-caching for endpoint.

...

Code Block
https://<service base>/ParamDemo/test

...

 

Sample Response Body

Here we are getting simple text response as we set in class library example.

 

Code Block
titleSample Response Data
Parameter with value :test

 

HTTP Status Codes

Status CodeMeaning
200OK; View data in response body
404Unauthenticated

...