Skip to Content

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:

/wp-content/uploads/2012/10/1_148721.png

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

/wp-content/uploads/2012/10/2_148722.png

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!

SAP_Clouds_White.jpg

To report this post you need to login first.

10 Comments

You must be Logged on to comment or reply to a post.

  1. Matthias Steiner

    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!

    (0) 
      1. Thomas Jung

        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.

        (0) 
          1. Thomas Jung

            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. 

            (0) 
  2. Herbert Zhao

    I got an error message such like that:

    exception

    javax.servlet.ServletException: Servlet execution threw an exception 

    root cause

    java.lang.LinkageError: loader constraint violation: loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) previously initiated loading for a different type with name "org/apache/http/client/HttpClient"

    java.lang.ClassLoader.defineClass1(Native Method) java.lang.ClassLoader.defineClass(ClassLoader.java:791)

    org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)

    org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:601)

    org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:567)

    org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:490)

    org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassName(ClasspathManager.java:469)

    org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:456)

    org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)

    org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)

    org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)

    org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)

    org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)

    org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)

    java.lang.ClassLoader.loadClass(ClassLoader.java:356)

    com.sap.neo.cloud.wsdl.service.wsdlService.doGet(wsdlService.java:49)

    javax.servlet.http.HttpServlet.service(HttpServlet.java:735)

    javax.servlet.http.HttpServlet.service(HttpServlet.java:848)

    Anyone can help me?

    (0) 

Leave a Reply