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.










share|improve this question




















  • 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 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












  • 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















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.










share|improve this question




















  • 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 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












  • 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













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.










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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, 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












  • 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




    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 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












  • 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












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






share|improve this answer








New contributor




slimane is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    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

























    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






    share|improve this answer








    New contributor




    slimane is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      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






      share|improve this answer








      New contributor




      slimane is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















        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






        share|improve this answer








        New contributor




        slimane is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        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







        share|improve this answer








        New contributor




        slimane is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        slimane is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 14 hours ago









        slimane

        462




        462




        New contributor




        slimane is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        slimane is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        slimane is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Costa Masnaga

            Fotorealismo

            Sidney Franklin