on 12-18-2013 9:03 AM
Hi all,
I've ran into a small issue with my SAPUI5 code. I've created a very simple SAP NetWeaver Gateway service and I am able to test this via restclient (in chrome or via the application).
Now when I do the following in my sapui5 controller
showSecondPage: function() { | |
var oAppData = sap.ui.getCore().getModel("app").getData(); | |
var oModel = new sap.ui.model.odata.ODataModel(oAppData.BaseURL, false, "user", "password"); | |
sap.ui.getCore().setModel(oModel); | |
sap.ui.getCore().getEventBus().publish("nav", "to", { | |
id : "ProductList" | |
}); | |
} |
Then I get following error on chrome when testing it
In the developers tool (Network section) i see that the $metadata call is formatted this way:
<user>:<password>@server:port/sap/opu/odata/sap/<GW_SERVICE>/$metadata
And the response for this call is the login-form from SAP
The thing is when i open another tab in chrome and go manually to the metadata url and log in there it just works.
So did i forget to do something in my code to get through this loginform directly by the ODataModel constructor?
Thanks in advance.
Kind regards,
Robin
Check this:
1. Gateway service has not defined an incorrect / hardcoded logon user in service runtime configuration.
2. User exists and isn't locked in Gateway System.
3. Try to introduce the same URL in navigator. The same behavior is produced with other user with SAP all authorization?
Kind regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The weird thing is when i navigate to the service document that I receive a logon screen
I don't think that this is normal no?
Shouldn't I receive a popup for asking credentials? The ODataModel constructor gives also this screen as response (network tab of google chrome developer tools) instead of the metadata document.
My user isn't locked, has SAP_ALL. And when i log in into that screen i receive the service document and can do everything I want.
Any idea?
Kind regards,
Robin
I feel that problem is with "oAppData.BaseURL". This URL may not be pointing right .
Can you put a breakpoint and check it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, I just doublechecked it:
The url in the oAppData.BaseURL variable is the correct one... on this url I can see the service document for the service.
The code stops on the ODataModel constructor, so the setModel(oModel) line is not reached. Because the sap login page is being called.
Any idea's
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.