Combining Netweaver Cloud and SAP HANA
Important edit: As Thomas Jung mentioned in comment:
Just to be clear: INA is Generally Available, but not designed nor intended to be used in this way. INA is supported when used as designed.
XS will supply the general REST service enablement you are looking for. These features of XS are planned to be available/supported with HANA 1.0 SP5 at the end of November.
You can get data from SAP HANA using XSEngine from Netweaver Cloud Connectivity Service. Let’s start…
I will use HANA AWS for this blog. So it will be total cloud solution!
First of all we will check our SAP HANA XSEngine. Enter your url:
http://host:80<instance>/sap/bc/ina/service/v1/
You will get it like this screen:
Then we will add a connection to Netweaver Cloud. You can get more information about this: https://help.netweaver.ondemand.com/default.htm?cs_getting_started.html#concept_036E470892E74053AC418647C4F13CC5_25
As you see on this screenshot we will use “Basic Authentication”. You can use full url of the Attribute view. By adding url like this you can use more than one Attribute View.
Add below to web.xml file.
<resource-ref>
<res-ref-name>awshana</res-ref-name>
<res-type>com.sap.core.connectivity.api.http.HttpDestination</res-type>
</resource-ref>
Let’s write some Java:
Context ctx = new InitialContext();
HttpDestination destination = (HttpDestination) ctx.lookup("java:comp/env/awshana");
HttpClient client = destination.createHttpClient();
HttpGet get = new HttpGet("/nwturk/AT_MATERIALCollection");
HttpResponse resp = client.execute(get);
HttpEntity entity = resp.getEntity();
} catch (DestinationException e) {
throw new RuntimeException(e);
} catch (NamingException e) {
throw new RuntimeException(e);
}
As you can see at line number 4 we added attribute view url. So you can get all attribute views like this.
HANA XSEngine returns you JSON format. So it is easy to parse data.
Happy cloud days!
Short, but interesting! Would be great if we' had a complete End-to-end walkthtrough on how to set it all up and get it running! 😉
Your blog is a good first step - thanks for sharing!
That will be another blog! An SAPUI5 application uses this connection!
A few problems with this blog. First you are using the SAP HANA UI Toolkit for Information Access (INA) and not the general capabilities of the SAP HANA Extended Application Services (XS). The INA framework is NOT a general purpose development environment and should only be used (and will only be supported) for the development of User Interfaces on top of search services.
The SAP HANA Extended Application Services (XS) does have a completely different way of defining OData (XSODATA) and general REST services (XSJS). However these capabilities are not planned to be released for customer and partner development until HANA 1.0 SP5 at the end of November.
Thanks for information. I edited blog.
Just to be clear: INA is Generally Available, but not designed nor intended to be used in this way. INA is supported when used as designed.
XS will supply the general REST service enablement you are looking for. These features of XS are planned to be available/supported with HANA 1.0 SP5 at the end of November.
Hi Erhan,
Great and creative use of an (unsupported) API. I love it. 5 Stars from me.
More thoughts on supported/unsupported here.
--Juergen
Good job as always Erhan! Will try out Neo as soon as I have some little time 🙂
Greetings,
Blag.
Erhan Keseli
When I acess the below link , i get a broken 404 response.
http://host:80<instance>/sap/bc/ina/service/v1/
do you need to activate anything , other than creating attribute views ?
I get the proper json and response from the below url
http://host:8000/package/revenue.xsodata/$metadata
Please advise
Hi,
It is about your HANA Version.
I got an error message such like that:
exception
root cause
Anyone can help me?