10-24-2017 7:06 AM - edited 02-04-2024 12:27 AM
Hello experts,
I'm following this blog to implement s4hana cloud sdk step 9 Implement and Deploy a Frontend Application.
I've set destination to Java application
In my ui5 application controller, onInit event, i try to make a request to java app.
$.ajax({
type: "GET",
url: "/FirstApp/products",
dataType: "json",
async: true,
success: function(oData) {
console.log(oData);
},
error: function(error) {
console.log(error);
}
});
It returns no data but this error
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
<meta http-equiv="pragma" content="no-cache" />
</head>
<body style="background-color:#FFFFFF">
<h1>Unauthorized</h1>
<HR size="1" noshade="noshade">
<p>
<b>type</b> Status report
</p>
<p>
<b>message</b>
<u>Unauthorized</u>
</p>
<p>
<b>description</b>
<u>This request requires HTTP authentication.</u>
</p>
</body>
</html>
I later add header to ajax call
$.ajax({
type: "GET",
url: "/FirstApp/products",
dataType: "json",
async: true,
headers: {
'Authorization': 'Basic ' + btoa('<username>:<password>')
},
success: function(oData) {
console.log(oData);
},
error: function(error) {
console.log(error);
}
});
But it still doesn't work.
What could cause this error?
Thanks in advance.
You have to setup both. The manifest.yml and xs-app.json.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You have to set you desired destination in the app-router configuration. You did it in cloud platform cockpit. Those are completely different destinations.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Frank,
Thanks for your reply.
I don't get your "app-router configuration". You mean manifest.json or neo-app.json?
In my neo-app.json, I included destination:
{
"welcomeFile": "/webapp/index.html",
"routes": [{
"path": "/resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/resources"
},
"description": "SAPUI5 Resources"
}, {
"path": "/test-resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/test-resources"
},
"description": "SAPUI5 Test Resources"
}, {
"path": "/FirstApp",
"target": {
"type": "destination",
"name": "FirstApp"
},
"description": "First App Java application"
}],
"sendWelcomeFileRedirect": true
}
Please let me know if this is correct.
Thanks in advance.
Tri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.