Learn to develop a JavaScript HTTP adapter.
The example here shows how to implement an adapter that connects with back-end HTTP services by using the connectivity facilities that are provided with MobileFirst Server. You can learn more about connectivity in The JavaScript adapter framework and HTTP adapter connectionPolicy element.
HTTP adapters work with RESTful and SOAP-based services, and can read structured HTTP sources such as RSS feeds.
You can easily customize HTTP adapters with simple server-side JavaScript code. For example, you can set up server-side filtering if necessary. The retrieved data can be in XML, HTML, JSON, or plain text format.
There are three parts to the implementation of a JavaScript adapter:
This page also shows you how to call a SOAP-based service in the HTTP adapter.
For more information about advanced adapter options, such as cookies, headers, and encoding, see HTTP adapter connectionPolicy element.
function getFeed() {
var input = {
method : 'get',
returnedContentType : 'xml',
path : "feed.xml"
};
return MFP.Server.invokeHttp(input);
}
You can also apply XSL transformation to the received data. For example, to filter the feed data.