If you have a comment on this topic, contact Aptify Documentation. If you want to return to the Aptify Community Site, please click here.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

 

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

  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.

 

 

 2. 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:

Once you saved the Controller record , the Controller Generated Classes fields will be automatically update.

Controller Routes 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.

      3. 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 two types of cache policies are available. 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.

        4Now 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.

       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.

Cached?No

Headers

For Above example we didn't select require authentication option on configuration section hence no need to pass header information

Sample Parameters

single parameter passed as 'param1' in above example.

ParameterQuery Param?DescriptionExample
param1YesThis parameter is send as response to usertest

 

 Sample URI for above example is 

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

 

Sample Response Body

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

 

Sample Response Data
Parameter with value :test

 

HTTP Status Codes

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

 

 

 

 


  • No labels