Skip to Content
0

404 Error while accessing HANA Odata

Jun 15, 2017 at 10:34 PM

555

avatar image

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.

10 |10000 characters needed characters left characters exceeded

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

0
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Deep Kripalsingh Tanwar Jun 26, 2017 at 07:19 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Daniel Degraf
Jun 17, 2017 at 02:27 PM
1

Hi,

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

Best regards

Daniel

Show 5 Share
10 |10000 characters needed characters left characters exceeded

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.

proj1.jpg (24.5 kB)
0

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

0

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

0

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.

0

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

xsproject.png (6.5 kB)
0
Frank Schuler
Jun 16, 2017 at 05:16 AM
-1

Hello Deep,

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

Best regards

Frank


server-port.png (28.4 kB)
Show 3 Share
10 |10000 characters needed characters left characters exceeded

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

0

@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.

0

@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.

untitled.png (42.3 kB)
0