GET Service call is not getting called from Controller
up vote
0
down vote
favorite
i am trying to introduce Angular into one of my old application. But not sure why this is not calling the Service. Below is the Code in the JS File. Earlier i got error in browser saying $http cannot be resolved . So i just passed it in the function.
var app = angular.module('ldlApp', );
app.controller('ldlController', function($scope,$http) {
console.log(" Inside Controller **** ");
$scope.message = 'Hello from LDL Controller !!!! ';
$scope.BLT_LDL_DECESION_LOAN_DATA = ;
console.log(" Going to Hit the Service ***** ");
$http.get("/Services/ldl/getdetails")
.then(function(response) {
$scope.BLT_LDL_DECESION_LOAN_DATA = response.data;
console.log("BLT_LDL_DECESION_LOAN_DATA:
"+JSON.stringify($scope.BLT_LDL_DECESION_LOAN_DATA));
});
});
Below is the REST Controller in java File
@RestController
public class LoanDecesionController {
@RequestMapping(value = "/Services/ldl/getdetails", method = RequestMethod.GET)
@ResponseBody
@Transactional
public List<LinkedHashMap<String, Object>> getdetails() throws Exception {
System.out.println(" Inside Service **** ");
List<LinkedHashMap<String, Object>> dataMap = new ArrayList<LinkedHashMap<String, Object>>();
LinkedHashMap<String, Object> responsedataMap = new LinkedHashMap<>();
responsedataMap.put("SUCESS", "Called the service ");
dataMap.add(responsedataMap);
return dataMap;
}
}
In Browser i could see message like
Inside Controller ****
Going to Hit the Service *****
Below is something i am seeing in network tab .
Request URL: https://*****-*****-*****.com/Services/ldl/getdetails
Request Method: GET
Status Code: 302 Found
Remote Address: 10.***.***.49:553
Referrer Policy: no-referrer-when-downgrade
But i am not getting the sysouts in controller. So whether the problem is really with response or is it hitting the service.
javascript java angularjs spring
add a comment |
up vote
0
down vote
favorite
i am trying to introduce Angular into one of my old application. But not sure why this is not calling the Service. Below is the Code in the JS File. Earlier i got error in browser saying $http cannot be resolved . So i just passed it in the function.
var app = angular.module('ldlApp', );
app.controller('ldlController', function($scope,$http) {
console.log(" Inside Controller **** ");
$scope.message = 'Hello from LDL Controller !!!! ';
$scope.BLT_LDL_DECESION_LOAN_DATA = ;
console.log(" Going to Hit the Service ***** ");
$http.get("/Services/ldl/getdetails")
.then(function(response) {
$scope.BLT_LDL_DECESION_LOAN_DATA = response.data;
console.log("BLT_LDL_DECESION_LOAN_DATA:
"+JSON.stringify($scope.BLT_LDL_DECESION_LOAN_DATA));
});
});
Below is the REST Controller in java File
@RestController
public class LoanDecesionController {
@RequestMapping(value = "/Services/ldl/getdetails", method = RequestMethod.GET)
@ResponseBody
@Transactional
public List<LinkedHashMap<String, Object>> getdetails() throws Exception {
System.out.println(" Inside Service **** ");
List<LinkedHashMap<String, Object>> dataMap = new ArrayList<LinkedHashMap<String, Object>>();
LinkedHashMap<String, Object> responsedataMap = new LinkedHashMap<>();
responsedataMap.put("SUCESS", "Called the service ");
dataMap.add(responsedataMap);
return dataMap;
}
}
In Browser i could see message like
Inside Controller ****
Going to Hit the Service *****
Below is something i am seeing in network tab .
Request URL: https://*****-*****-*****.com/Services/ldl/getdetails
Request Method: GET
Status Code: 302 Found
Remote Address: 10.***.***.49:553
Referrer Policy: no-referrer-when-downgrade
But i am not getting the sysouts in controller. So whether the problem is really with response or is it hitting the service.
javascript java angularjs spring
1
Please indent your code, it's unreadable.
– sjahan
18 hours ago
2
And use debugging tools (specifically your browser's Network tab) to see whether the request is being transmitted properly.
– chrylis
18 hours ago
As @chrylis said, check the network tab. I can guess that your request didn't return HTTP 200, sothen
is not fired.then
is only fired on a successful response from the server, try adding acatch
to print if the server returned an error HTTP return code.
– sjahan
17 hours ago
Updated the question with what i am seeing in the browser network tab
– Vinoy
17 hours ago
you get a 302 which is a redirect. In the answer there must be a Location header giving the url to which the redirect points. You have to extract that and post a new request to this url.
– P.J.Meisch
14 hours ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
i am trying to introduce Angular into one of my old application. But not sure why this is not calling the Service. Below is the Code in the JS File. Earlier i got error in browser saying $http cannot be resolved . So i just passed it in the function.
var app = angular.module('ldlApp', );
app.controller('ldlController', function($scope,$http) {
console.log(" Inside Controller **** ");
$scope.message = 'Hello from LDL Controller !!!! ';
$scope.BLT_LDL_DECESION_LOAN_DATA = ;
console.log(" Going to Hit the Service ***** ");
$http.get("/Services/ldl/getdetails")
.then(function(response) {
$scope.BLT_LDL_DECESION_LOAN_DATA = response.data;
console.log("BLT_LDL_DECESION_LOAN_DATA:
"+JSON.stringify($scope.BLT_LDL_DECESION_LOAN_DATA));
});
});
Below is the REST Controller in java File
@RestController
public class LoanDecesionController {
@RequestMapping(value = "/Services/ldl/getdetails", method = RequestMethod.GET)
@ResponseBody
@Transactional
public List<LinkedHashMap<String, Object>> getdetails() throws Exception {
System.out.println(" Inside Service **** ");
List<LinkedHashMap<String, Object>> dataMap = new ArrayList<LinkedHashMap<String, Object>>();
LinkedHashMap<String, Object> responsedataMap = new LinkedHashMap<>();
responsedataMap.put("SUCESS", "Called the service ");
dataMap.add(responsedataMap);
return dataMap;
}
}
In Browser i could see message like
Inside Controller ****
Going to Hit the Service *****
Below is something i am seeing in network tab .
Request URL: https://*****-*****-*****.com/Services/ldl/getdetails
Request Method: GET
Status Code: 302 Found
Remote Address: 10.***.***.49:553
Referrer Policy: no-referrer-when-downgrade
But i am not getting the sysouts in controller. So whether the problem is really with response or is it hitting the service.
javascript java angularjs spring
i am trying to introduce Angular into one of my old application. But not sure why this is not calling the Service. Below is the Code in the JS File. Earlier i got error in browser saying $http cannot be resolved . So i just passed it in the function.
var app = angular.module('ldlApp', );
app.controller('ldlController', function($scope,$http) {
console.log(" Inside Controller **** ");
$scope.message = 'Hello from LDL Controller !!!! ';
$scope.BLT_LDL_DECESION_LOAN_DATA = ;
console.log(" Going to Hit the Service ***** ");
$http.get("/Services/ldl/getdetails")
.then(function(response) {
$scope.BLT_LDL_DECESION_LOAN_DATA = response.data;
console.log("BLT_LDL_DECESION_LOAN_DATA:
"+JSON.stringify($scope.BLT_LDL_DECESION_LOAN_DATA));
});
});
Below is the REST Controller in java File
@RestController
public class LoanDecesionController {
@RequestMapping(value = "/Services/ldl/getdetails", method = RequestMethod.GET)
@ResponseBody
@Transactional
public List<LinkedHashMap<String, Object>> getdetails() throws Exception {
System.out.println(" Inside Service **** ");
List<LinkedHashMap<String, Object>> dataMap = new ArrayList<LinkedHashMap<String, Object>>();
LinkedHashMap<String, Object> responsedataMap = new LinkedHashMap<>();
responsedataMap.put("SUCESS", "Called the service ");
dataMap.add(responsedataMap);
return dataMap;
}
}
In Browser i could see message like
Inside Controller ****
Going to Hit the Service *****
Below is something i am seeing in network tab .
Request URL: https://*****-*****-*****.com/Services/ldl/getdetails
Request Method: GET
Status Code: 302 Found
Remote Address: 10.***.***.49:553
Referrer Policy: no-referrer-when-downgrade
But i am not getting the sysouts in controller. So whether the problem is really with response or is it hitting the service.
javascript java angularjs spring
javascript java angularjs spring
edited 16 hours ago
asked 18 hours ago
Vinoy
306
306
1
Please indent your code, it's unreadable.
– sjahan
18 hours ago
2
And use debugging tools (specifically your browser's Network tab) to see whether the request is being transmitted properly.
– chrylis
18 hours ago
As @chrylis said, check the network tab. I can guess that your request didn't return HTTP 200, sothen
is not fired.then
is only fired on a successful response from the server, try adding acatch
to print if the server returned an error HTTP return code.
– sjahan
17 hours ago
Updated the question with what i am seeing in the browser network tab
– Vinoy
17 hours ago
you get a 302 which is a redirect. In the answer there must be a Location header giving the url to which the redirect points. You have to extract that and post a new request to this url.
– P.J.Meisch
14 hours ago
add a comment |
1
Please indent your code, it's unreadable.
– sjahan
18 hours ago
2
And use debugging tools (specifically your browser's Network tab) to see whether the request is being transmitted properly.
– chrylis
18 hours ago
As @chrylis said, check the network tab. I can guess that your request didn't return HTTP 200, sothen
is not fired.then
is only fired on a successful response from the server, try adding acatch
to print if the server returned an error HTTP return code.
– sjahan
17 hours ago
Updated the question with what i am seeing in the browser network tab
– Vinoy
17 hours ago
you get a 302 which is a redirect. In the answer there must be a Location header giving the url to which the redirect points. You have to extract that and post a new request to this url.
– P.J.Meisch
14 hours ago
1
1
Please indent your code, it's unreadable.
– sjahan
18 hours ago
Please indent your code, it's unreadable.
– sjahan
18 hours ago
2
2
And use debugging tools (specifically your browser's Network tab) to see whether the request is being transmitted properly.
– chrylis
18 hours ago
And use debugging tools (specifically your browser's Network tab) to see whether the request is being transmitted properly.
– chrylis
18 hours ago
As @chrylis said, check the network tab. I can guess that your request didn't return HTTP 200, so
then
is not fired. then
is only fired on a successful response from the server, try adding a catch
to print if the server returned an error HTTP return code.– sjahan
17 hours ago
As @chrylis said, check the network tab. I can guess that your request didn't return HTTP 200, so
then
is not fired. then
is only fired on a successful response from the server, try adding a catch
to print if the server returned an error HTTP return code.– sjahan
17 hours ago
Updated the question with what i am seeing in the browser network tab
– Vinoy
17 hours ago
Updated the question with what i am seeing in the browser network tab
– Vinoy
17 hours ago
you get a 302 which is a redirect. In the answer there must be a Location header giving the url to which the redirect points. You have to extract that and post a new request to this url.
– P.J.Meisch
14 hours ago
you get a 302 which is a redirect. In the answer there must be a Location header giving the url to which the redirect points. You have to extract that and post a new request to this url.
– P.J.Meisch
14 hours ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
when using @Transactional
and @ResquestMaping
spring boot don't auto-configure URL mappings. remove @Transactional
from your method and try to manage transactions somewhere else in your code
New contributor
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
when using @Transactional
and @ResquestMaping
spring boot don't auto-configure URL mappings. remove @Transactional
from your method and try to manage transactions somewhere else in your code
New contributor
add a comment |
up vote
0
down vote
when using @Transactional
and @ResquestMaping
spring boot don't auto-configure URL mappings. remove @Transactional
from your method and try to manage transactions somewhere else in your code
New contributor
add a comment |
up vote
0
down vote
up vote
0
down vote
when using @Transactional
and @ResquestMaping
spring boot don't auto-configure URL mappings. remove @Transactional
from your method and try to manage transactions somewhere else in your code
New contributor
when using @Transactional
and @ResquestMaping
spring boot don't auto-configure URL mappings. remove @Transactional
from your method and try to manage transactions somewhere else in your code
New contributor
New contributor
answered 14 hours ago
slimane
462
462
New contributor
New contributor
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53349350%2fget-service-call-is-not-getting-called-from-controller%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Please indent your code, it's unreadable.
– sjahan
18 hours ago
2
And use debugging tools (specifically your browser's Network tab) to see whether the request is being transmitted properly.
– chrylis
18 hours ago
As @chrylis said, check the network tab. I can guess that your request didn't return HTTP 200, so
then
is not fired.then
is only fired on a successful response from the server, try adding acatch
to print if the server returned an error HTTP return code.– sjahan
17 hours ago
Updated the question with what i am seeing in the browser network tab
– Vinoy
17 hours ago
you get a 302 which is a redirect. In the answer there must be a Location header giving the url to which the redirect points. You have to extract that and post a new request to this url.
– P.J.Meisch
14 hours ago