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.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
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.