Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
With the release of SAP HANA smart data streaming 2.0 come enhancements to the HTTP Client Output adapter, as well as two new adapters: the HTTP Client XML Output adapter and the HTTP Client JSON Output adapter. These enhancements and new adapters are also available with the release of 1.0 SP 12 patch 3. Now, you can send OData POST requests and connect to XS advanced (XSA) applications in your project—something you could not do previously.

How did you connect to XSA applications before?

Previously, you needed to code and implement a custom adapter or SDK application to output data to XSA applications. With the new improvements to the HTTP Client Output adapter and the introduction of two new adapters, you now have another, easier way to integrate your XSA applications into your streaming projects.

What are the new features and improvements?

In the HTTP Client Output adapter and the two new adapters, you can use a new parameter called contentType to send OData requests in the following content types:

  • text/plain

  • text/xml

  • text/html

  • application/atom+xml

  • application/json

  • application/xml


The HTTP Client XML Output adapter and the HTTP Client JSON Output adapter were both built using the adapter toolkit. Use the first adapter to send OData POST requests in XML format, and the second to send them in JSON format. Both adapters can send content in multiple columns of data, whereas the HTTP Client adapter can only send one column at a time.
All three adapters also support CSRF authentication.

How do I use the new improvements and adapters?

Suppose you want to connect to an XSA application. In the application, a HANA table is defined in an hdb module. The code that defines this is below:
namespace hello.db;
context test {
entity TestHttpClientJSONOutputAdapter {
key Col1 : String(200);
Col2 : Integer;
};
};

The table also has to be exposed as an OData service. In the nodejs module of the XSA application, this is done by a file called basic.xsodata. The code that exposes the table as an OData service is below:
service {
"hello.db::test.TestHttpClientJSONOutputAdapter" as "TestHttpClientJSONOutputAdapter";
}

To output data to the XSA application, we use a streaming project that receives data and outputs it to the HANA server through a HTTP Client JSON Output adapter. An input stream, MyInStream, receives data in two columns also named Col1 and Col2. Just like in the HANA table, the first receives string values, while the second receives integer values. The stream is attached to an HTTP Client JSON Output adapter, which sends the values from both columns to the HANA table.

The CCL for the project is below:
CREATE INPUT WINDOW MyInStream
SCHEMA (Col1 STRING,Col2 INTEGER)
PRIMARY KEY (Col1);

ATTACH OUTPUT ADAPTER HTTP_Client_JSON_Output_Adapter1 TYPE toolkit_http_json_output
TO MyInStream
PROPERTIES
bodyCharset = 'UTF-8' ,
jsonColsMappingList = 'Col1,Col2' ,
OutputBase = TRUE ,
requestUrl = <my.hana.hostname>:<port.number>/testHttpClientJSONOutputAdapter/basic.xsodata/TestHttpClientJSONOutputAdapter' ,
csrfTokenFetchUrl = '<my.hana.hostname>:<port.number>/testHttpClientJSONOutputAdapter/basic.xsodata/TestHttpClientJSONOutputAdapter' ;

To test the project, we can manually input three rows of data for Col1 and Col2 in the Streaming Run-Test perspective (in HANA studio). The input window looks like this:

After manually inputting the rows, the stream view should look something like this:

Finally, we can check the HANA table in the database and see that the three rows of data we gave to the input stream have been successfully received through the HTTP JSON Client Output adapter:

References

Want to see what other new features we’re offering? Check out our other blogs on new features in 2.0:

Also make sure to check out our What’s New video below!



For full details of all the new features and improvements we’ve added, take a look at What’s New in SAP HANA Smart Data Streaming, on the SAP Help Portal.
3 Comments