cancel
Showing results for 
Search instead for 
Did you mean: 

404 Error while accessing HANA Odata

deeptanwar
Explorer
0 Kudos

I am creating an Odata Service using SAP HANA Studio and running into 404 - Not Found. I checked and XSEngine is running, I validated that by just using hostname, port and instance. I tried both HTTPS and HTTP and getting message that XSEngine is running, but when I am trying to call my test odata service I am getting 404 - Not Found message.

https://hostname:43<Instance>/odatatest/premise.xsodata.

One point to note system I am working on is a multitenant DB.

Please let me know if you have any suggestions for troubleshooting.

pfefferf
Active Contributor
0 Kudos

Do you have an .xsapp and and .xsaccess file in your project? What is the value of property "exposed" in your .xsaccess file?

Accepted Solutions (1)

Accepted Solutions (1)

deeptanwar
Explorer
0 Kudos

This issue can only be resolved once xsengine is configured on your multi-tenant system. HANA Admin team helped me with this and its working now.

former_member831615
Discoverer
0 Kudos

Hi deep.kripalsinghtanwar, I'm also facing same issue, Could you please explain a bit about configurations that you did to overcome this issue?

Answers (2)

Answers (2)

Hi,

Did you create an .xspp and .xsaccess file, to expose XS services?

Best regards

Daniel

former_member188321
Contributor
0 Kudos

yes, the files exist. .xspp has no content. .xsaccess has

{ 
   "exposed" : true, 
   "authentication" : { "method" : "Form"},
   "prevent_xsrf" : true
}

Still the error appears on executing it. The issue is same with .XSJS too, which gives same error on execution.

deeptanwar
Explorer
0 Kudos

@Daniel - Thank You so much for your reply. Yes I can see these files.

former_member188321
Contributor
0 Kudos

@Deep Did this solve the issue for you? for me the files are there but error still appear.

0 Kudos

Hi,
from your screenshot I assume that you've created an XS project in SAP HANA Studio.

1) Make sure that .xsapp exists:

{}

2) Make sure that .xsaccess exists:

{
     "exposed" : true,        
     "authentication" : {"method": "Form" }
}

3) Create a xsjs or xsodata file. In my case its a xsjs file:

//**** Example for basic REQUEST RESPONSE handling
var paramName; var paramValue; var headerName; var headerValue; var contentType;
//Implementation of GET call
function handleGet() {
	// Retrieve data here and return results in JSON/other format 
	$.response.status = $.net.http.OK;
	 return {"myResult":" GET success"};
}
//Implementation of POST call
function handlePost() {
	var bodyStr = $.request.body ? $.request.body.asString() : undefined;
	if ( bodyStr === undefined ){
		 $.response.status = $.net.http.INTERNAL_SERVER_ERROR;
		 return {"myResult":"Missing BODY"};
	}
	// Extract body insert data to DB and return results in JSON/other format
	$.response.status = $.net.http.CREATED;
    return {"myResult":"POST success"};
}


// Request process 
function processRequest(){
		try {
		    switch ( $.request.method ) {
		        //Handle your GET calls here
		        case $.net.http.GET:
		            $.response.setBody(JSON.stringify(handleGet()));
		            break;
		            //Handle your POST calls here
		        case $.net.http.POST:
		            $.response.setBody(JSON.stringify(handlePost()));
		            break; 
		        //Handle your other methods: PUT, DELETE
		        default:
		            $.response.status = $.net.http.METHOD_NOT_ALLOWED;
		            $.response.setBody("Wrong request method");		        
		            break;
		    }
		    $.response.contentType = "application/json";	    
		} catch (e) {
		    $.response.setBody("Failed to execute action: " + e.toString());
		}
}
// Call request processing  
processRequest();

4) The path in your XS project has to be added to your service path. I noticed from your screenshots, that you named your service ZPO.xsodata, but you try to access https://hostname:43<Instance>/odatatest/premise.xsodata
Make sure that you get the XS Engine is up and running message, when accessing https://hostname:43<Instance>/.

From my screenshot it is:

https://<host>:<port>/Test/<black>/TestXS/service.xsjs

Hope that helps.

Best regards

Daniel

deeptanwar
Explorer
0 Kudos

Damandeep Thakur - I am following it up with HANA Admin, they told me they will try and get it resolved in two days. I think its because of multi-tenant DB. We also have a HANA system set-up where this architecture is not used and from that system I am able to create and execute odata services.

I will share update/details if this issue is resolved in two days or less.

architectSAP
Active Contributor
0 Kudos

Hello Deep,

Pease check your HTTP and HTTPS server ports in webdispatcher.ini:

Best regards

Frank

former_member188321
Contributor
0 Kudos

Where to see this file? I have the same issue. I am trying in HANA studio, not on Cloud Editor.

deeptanwar
Explorer
0 Kudos

@Frank - Thank You for your reply. I did check and I am not able to see these values under Configuration tab of Admin Prospective. I will check with BASIS team tomorrow and will update comments if issue is fixed. Thank You once again.

deeptanwar
Explorer
0 Kudos

@Frank - As its a multi-tenant DB I tried to explain this to our HANA Admin. They told me that its configured in SYSTEMDB

but when I am checking in DB (lets call it DB1) I am logged into I dont have webdispatcher.ini on that server.

I checked link access-to-multitenant-database and it seems a new wdisp/system_n is needed for DB1 in SYSTEMDB.

But only thing is I can access XSEngine page from DB1.