Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Web Service request in extension

I'm currently working on a Google Map extension where i want to consume an XML output from a web service that i am attempting to call.  I'm not an expert in Javascript or jQuery (which i belive will help me collect the XML) so i'm learning as i go along.  

Does anyone have an example of an extension that they are doing something similar what they wouldn't mind sharing in order that i can gain the knowledge needed to implement it into my extension?

This is my code which currently fails in the pareseResult function on the 'length' flag

    Qva.LoadScript ("Extensions/Mouchel/GMapsRealTime/jquery-1.4.4.min.js", function () {

                    // For more information on doing XMLHR with jQuery, see these resources:

                    // http://net.tutsplus.com/tutorials/javascript-ajax/use-jquery-to-retrieve-data-from-an-xml-file/

                    // http://marcgrabanski.com/article/jquery-makes-parsing-xml-easy

                    $(document).ready(function() {

                      $.ajax({

                              type: "POST",

                              url: "http://localhost/CEOStatusWebService/CEOStatus.asmx/GetStatusForAllCEOs",

                              data: "{}",

                              contentType: "application/xml; charset=utf-8",

                              dataType: "xml",

                              success: ajaxCallSucceed,

                              failure: ajaxCallFailed

                              // success: function(msg) {

                              // alert( "Data Saved: " + msg.d );

                              // ServiceSucceeded(msg);

                                // $('#RSSContent').removeClass('loading');

                                // $('#RSSContent').html(msg.d);

                                // alert("got here");

                              // }

                              // failure: function(msg) {

                              // funcitonToCallWhenFailed(msg);

                              // }

                      });

                    });

          });

          function ajaxCallSucceed(response) {

            alert("in success message");

                              $('#divLoading').hide();

            var CEO = eval('(' + response.d + ')');

                              alert(response.d);

                              alert(CEO);

            pareseResult(CEO);

        }

          function ajaxCallFailed(error) {

                    alert("in failed message");

                    $('#divLoading').hide();

                    alert('error: ' + error);

                    $('#divResults').hide();

          }

          function pareseResult(CEO) {

                    var lists = '';

                    for (var i = 0; i < CEO.length; i++) {

                              if (lists == '') {

                                        lists = CEO.ProductName;

                              }

                              else {

                                        lists = lists + " <br />" + CEO.ProductName;

                              }

                    }

                    $('#divResults').html(lists);

                    $('#divResults').show();

          }

Thanks

Lewis

34 Replies
Not applicable
Author

Brian

Thought you would be pleased to know that i have now got the webservice data putting markers onto my GMap.  Many thanks for all your help in getting this working!!!

Once last thing i need to do though is force the extension to reload the webservice data every 'x' minutes - any help in this would be great, or even a nudge in teh right direction?

Lewis

Brian_Munz
Employee
Employee

Hi Lewis.

To set a function to run every few minutes or so, just use setInterval.  So if your function to run the service was called gService, you could set it to run every 120 seconds like this:

var gTimer = setInterval(gTimer, 120000);

qlikviewforum
Creator II
Creator II

Hi All

The particular sharepoint where I am going to fetch the data needs authentication. Could you please let me how that can be done please.

Created the new thread for the same below.

http://community.qlik.com/message/249859#249859

Thanks,

qlikview forum

qlikviewforum
Creator II
Creator II

Hi All,

I tried my level best but unfortunately couldn't able to succeed yet.

I read some where about QVSource. Is it possible to load the data from secured sharepoint site using the same? Any help please?

Thanks,

qlikviewforum

Not applicable
Author

Did you ever run into any Windows Security Warnings while developing this?

I am doing an extension object that calls web services using SOAP and I get the Windows Security Warning pop up because of the cross domain scripting. It goes away if I enable "Access data sources across domains" in IE, but that is not a likely solution for our clients as most of them have that settings locked down by their IT.