Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Not able to expose OData Service

$
0
0

I am a beginner to server side java script(XSJS) as well as OData.                                       

I am trying to expose the .xsjs,.xsodata files data and access through webbrowser with the following url containing hostname,portnumber and package path as shown below:

 

 

"hostname:80<instance#>/workspace/session/a00/data/services/retrieveData.xsjs"

 

 

and i am getting the following error when i am trying to access it.   

 

 

"This link seems to be broken

We could not find the resource you're trying to access.

It might be misspelled or currently unavailable"

 

 

These are the files which i have created in the project explorer:   

1.An Empty file with file extension .xsapp 

2.A file with extension .xsaccess:  

 

 

            {

            "exposed":true,

            "authentication":[{"method":"LogonTicket"},{"method":"Basic"}]

            }

 

 

3.A file MYSCHEMA.hdbschema:

 

 

schema_name="MYSCHEMA"

 

 

4.A file with name trendsData.hdbtable

 

 

    table.schemaName = "MYSCHEMA";                                                          

    table.tableType = COLUMNSTORE;  

    table.description = "NewDataSet Order trendsData";

 

    table.columns = [

 

 

           {name= "CA";  sqlType = NVARCHAR; nullable = true; length=10; },

           {name= "D";  sqlType = VARCHAR;  nullable = true; length=5;  },

           {name= "DU"; sqlType = NVARCHAR; nullable = true; length=20; },

           {name= "SAL";     sqlType = DECIMAL;  nullable = true; length=30; },

           {name= "IN";     sqlType = DECIMAL;  nullable = true; length=30; },

           {name= "G";       sqlType = DECIMAL;  nullable = true; length=30; },

           {name= "GM";         sqlType = DECIMAL;  nullable = true; length=20; },

           {name= "STR";           sqlType = DECIMAL;  nullable = true; length=30; }

            ];

     table.primaryKey.pkcolumns = ["INVENTORY"];

 

 

5.A file with name orderId.hdbsequence:

 

 

   schema="MYSCHEMA";    

    start_with=2000000;

    cycles=false;   

    depends_on_table="workspace.session.a00.data::trendData";

 

 

6.A file with name retrieveData.xsjs:              

 

 

    $.response.contentType="text/html";                                                                   

    var output = "Helloworld";                                                                               

    var conn  = $.db.getConnection();

 

    var pstmt = conn.prepareStatement("select * from trendData");

 

    var rs    = pstmt.executeQuery();

 

    if (!rs.next())                                                                                  

    {

              $.response.setBody( "Failed to retrieve data");

              $.response.status = $.net.http.INTERNAL_SERVER_ERROR;

    }

 

    else                                                                                       

    {                                                                                           

    output=output + "This is the respose from my SQL: "                                                    

    + rs.getString(1);                                                                               

    }                                                                                        

    rs.close();                                                                                  

    pstmt.close();                                                                         

    conn.close();                                                                

    $.response.setBody(output);

 

 

7.A OData service file with name trendsData.xsodata:

 

 

service namespace "workspace.session.a00.data"

{

    "MYSCHEMA"."workspace.session.a00.data::trendData" 

     as "TRENDDATA";

}

 

Repository View below

repository_View.png

 

Projects Explorer View

 

Project_exp_view_crop.png

 

 

Navigator View

 

navigator_view_crop.png

 

 

All the above files were successfully committed and activated with out any error.But the error still occurs when I access to access it in browser.

 

 

Any help would be appreciated.

Thanks for your time.


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>