cancel
Showing results for 
Search instead for 
Did you mean: 

Calling an oData Service from a Servlet

Former Member
0 Kudos

Hi Experts,

I am building a SAPUI5 application that will need to call several oData services, these services require to authenticate. I'm well aware that SAPUI5 provides a way to call this services with something like:


var oModel = new sap.ui.model.odata.ODataModel("http://myserver.com",true,"john","doe768.9");

However I do not want to hard code the user and pass in the js files.

Is there any way to call an oData Servlet from a servlet ? perhaps something similar to a Web Service client?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

kammaje_cis
Active Contributor
0 Kudos

True that you would never hardcode passwords in any production code.

Right way to authenticate is to use SSO, SAML or various authentication methods.

If you do not pass password, a pop-up would be thrown for the user to enter credentials and based on your settings you can get logon tickets as well for further calls.

Answers (1)

Answers (1)

former_member182650
Contributor
0 Kudos

Hi Yalan,

I'm totally agree with Krishna. Only standard mechanism like SSO (Ticket, SAML, etc) or UWP (Us&Pwd) are standard scenarios. There's an option if you publish your SAPUI5 under SAP NW Portal, you could use User Mapping Mechanism & SSO with SAP Logon ticket.

You could also develop a custom token mechanism (Software token - Wikipedia, the free encyclopedia).

Kind regards

Former Member
0 Kudos

Hi Angel, Krishna thanx for replying,

User Mapping seems like a good idea since I want to allow multiple users to consume the oDatas without having to create X number of them in the gateway, so yeah I guess ill go with that. Just one more question my sapui5 app will be stored in portal and will need to call the odatas from gw do you guys know how to achieve that?

former_member182650
Contributor
0 Kudos

Hi again,

You could publish your Portal and GW under a web proxy like Web Dispatcher. If your portal and gateway shares the same domain, SSO Cookie, SAP Logon Ticket will be attached as a request cookie in GW calls.

Kind regards!