Skip to Content
author's profile photo Former Member
Former Member

SAP Hana Anonymous User? And HTTP POST method?

Hi,

I currently would like to use anonymous user. But how do I go about setting up a SQLCC entry and embed a user name and password in their which will be used by the anonymous service. I would like end user to have anonymous authentication to hana server, but the final data that is retrieved is from an Odata service. Could you direct me as to how to go about the whole thing.

Also, currently in SAP Hana the http method defined is GET, for POST method it displays 405 Method Not Allowed error. How to configure http to accept post method.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Sep 12, 2013 at 06:53 PM

    Expanding on Michael's answer, if you are trying to access an OData service (ie. not using XS code to access the data), you can set the "anonymous_connection" param in your .xsaccess file to the xssqlcc you've created.

    The final .xsaccess file may look something like this:

    {

    "anonymous_connection": "yourpackage::anonuser",

    "authentication" : null,

    "exposed": true

    }

    Assuming you also have an odata service defined via svc.xsodata, you can then access it with no authentication.

    Ex.

    http://yourserver:8000/yourpackage/svc.xsodata

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Johnson,

      Your reply was really helpful. I am working with oData services and your reply just helped me a lot.

      I was getting 403 forbidden error now that is resolved. I am able to get data using my odata service.

      But when I am trying to post data using Postman i am getting 503 service unavailable error. I am able to get data in the postman but not post.

      If you could help me?

      Thanks in advance.

      regards,

      Animesh Ghosh

  • Posted on Jul 24, 2014 at 11:21 PM

    Hi Aisha.

    For this problem the better solution is:

    1. We need create the file .xsaccess with the next instruction:

    {

    "exposed" : true,

    "authentication" : null,

    "anonymous_connection":"PackageName::Anonymous_Access"

    }

    2. Create the file Anonymous_Access.xssqlcc with the next instruction:

    {

    "description" : "Anonymous SQL connection for ..."

    }

    3. Like our friend Micheal, in the .xsjs file, reference the .xssqlcc file in getConnection() ...

    var conn = $.db.getConnection("packagename::Anonymous_Access");

    4. Enter in the link http://yourhanaserver:80instance/sap/hana/xs/admin/ - Access into XS Administration Page.

    5. Search your package and the file Anonymous_Access.xssqlcc, and select it.

    6. Intruduce the username and save.

    I hope this help you.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 21, 2016 at 06:52 AM

    Hi everyone,

    I had the same requirement as Aisha, where I had to provide anonymous access to an Odata service I had created. Going through this post, the solution for this exact requirement is not quite apparent. Therefore, I present the solution as shown below. I have combined the steps and solutions provided by others in this thread.

    1. Create a .xssqlcc file ... Say anonuser.xssqlcc

    {

    "description" : "Anon SQL connection"

    }

    2. Create a .xsjs file, reference the .xssqlcc file in getConnection() ...


    var conn = $.db.getConnection("hana_hello::anonuser");


    Which means only the above line should be in the .xsjs file.


    3. Create a .xsaccess file, if not already created, with authentication = null, along with the anonymous connection statement ...

    {

    "exposed" : true,

    "authentication" : null

    "anonymous_connection": "yourpackage::anonuser",

    }

    4. Finally, update the "_SYS_XS"."SQL_CONNECTIONS" table. Set the username to someone that has access to the database you are trying to call. This should happen in the SQLCC application, but it doesn't seem to work ... this is the code that is in that application. Run the SQL command ...

    UPDATE "_SYS_XS"."SQL_CONNECTIONS" SET username = '<database_user>' WHERE name = 'hana_hello::anonuser';


    Preferably, use Thomas Jung's method to perform the above step, but if you don't have admin privileges, then the above SQL statement works fine.


    Regards,

    Rolan Carlo

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Rolan,

      Yes. I had done those changes.

      But I haven't been able to go deep into it, as it has been decided to keep the authentication for now.

      If we plan to use without authentication in future, then I will check those again, and if incase I get stuck, will open a open thread.

      Thanks for the help 😊

      BR

      SN

  • author's profile photo Former Member
    Former Member
    Posted on Jul 30, 2013 at 06:42 PM

    I found the answer ... well Jon found the answer ,,,

    To allow the service to be accessed anonymously ...

    1. Add a .xsaccess file with authentication = null ...

    {

    "exposed" : true,

    "authentication" : null

    }

    2. Create a .xssqlcc file ... I called it anonuser.xssqlcc

    {

    "description" : "Anon SQL connection"

    }

    3. In the .xsjs file, reference the .xssqlcc file in getConnection() ...

    var conn = $.db.getConnection("hana_hello::anonuser");

    4. Finally, update the "_SYS_XS"."SQL_CONNECTIONS" table. Set the username to someone that has access to the database you are trying to call. This should happen in the SQLCC application, but it doesn't seem to work ... this is the code that is in that application. Run the SQL command ...

    UPDATE "_SYS_XS"."SQL_CONNECTIONS" SET username = 'ANON_USER1' WHERE name = 'hana_hello::anonuser';

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.