SendRequest plugin allows mapping a SP command to an arbitrary, external HTTP GET request and transforming the response XML into a common XML listing using a simple XPATH expression. It can be used to abstract the external web service format from the client, e.g to have a way of switching providers of the service. One example is the autocomplete functionality, which will serve as an example below.
The plugin is mapped to a SP command (chain) and may take arbitrary parameters. Those parameters can be then used in the url recipe that specifies the request that gets sent out to the external service.
E.g
http://somehost/service-proxy/?command=autocomplete&query=water
SendRequest can be mapped to an arbitrary chain.
chains.autocomplete = autocomplete_request
Specifies the recipe for the URL that will be requested when the plugin is invoked. Can include references to arbitrary SP input parameters. The following example is a recipe for the solr terms request and includes a reference to the 'query' input parameter.
Mandatory, no default
Example:
autocomplete_request.URL_PATTERN = http://somehost.com/solr/terms?terms.fl=subject_exact&terms.prefix=${query}
An xpath expression that controls how the response is mapped into the output XML list (the plugin always expects to receive XML from the external web service).
Mandatory, no default
Example:
autocomplete_request.ITEM_XPATH = response/lst[@name='terms']/lst[@name='subject_exact']/int/@name