AUTOCOMPLETE Control with url source and Authorisation request header

Hello,

I’trying to figure out how to use the AUTOCOMPLETE control with the source property set to url. In my case the service providing the data also needs Basic Authorisation and I have to provide the Base64 Encoded Authorisation Header.

Is it possible to achieve that with the AUTOCOMPLETE control?

I also found one presentation, where the usage of the control is explained (https://www.softwareag.com/us/images/4Adabas_Natural_Overview_Roadmap_TechEd2015_v1.5_tcm89-130882.pdf). In there a local service is invoked via localhost:8080/autocomplete/natrpc?id=cities. It seems that this service is part of ther Natural Environment but doesn’t need any sort of authorisation. Is this service somehow shipped automatically with Ajax or Natrpc Server?

Regards,
Rok

Hi Rok,

You specify the url of your service in the sourcelocation property or in the Natural field for the sourcelocationprop correspondingly.
The service must return the data is json format. A service can for instance be a simple Java servlet. Here you find more information about the service and control properties:

http://techcommunity.softwareag.com/ecosystem/documentation/natural/njx838/njx/autocomplete.htm

Regarding a Natural RPC service:
If you have Natural ONE installed, you can install the NaturalAjaxSamples from the Welcome page. These sample contain a *.pdf document, which exactly describes the steps how to use and create a Natural RPC Service as autocomplete source.
You’ll find the document in this folder:
NaturalAjaxDemos/njxdemos/autocomplete/NaturalAutocompleteRPCService.pdf

Regarding http headers:
Technically it is possible to apply http headers to the service. But we haven’t added a corresponding property to the autocomplete control yet. How would you like to apply such headers? Statically at design time or dynamically at runtime?

As a workaround for now you could add a small Servlet - just a few lines of code - which calls your service using the corresponding http headers.

Best Regards,
Christine

Hello Christine,

thanks for your reply - I got the Natural RPC Service in a servlet up and running.

Regarding http headers - yes I think it would be a good idea to provide properties (both static at design time and dynamic at runtime) for setting custom http headers for the request providing the autocomplete data. Perhaps there might be other scenarios besides authorisation, where a user must set a specific header to access the remote service.

Best Regards
Rok Purkeljc