Qlik Community

Qlik FinServ

A private group designed to enable innovation, share best practices and educate QlikView users in the Financial Services industry. You will not see any content if you are not a member, you can request to join by pressing "Join the Group"

Highlighted
Employee
Employee

Call a web service via SOAP, HTTP Get or HTTP Post

I recently needed to illustrate how QlikView can be used to call a web service via SOAP. I could not find anything on community that actually made a SOAP call, so I put together this proof of concept application.

I found a public web service on the web that can be called via a HTTP Get, HTTP Post or SOAP method and built this app to show how each can be done. In each case I have used vbscript and the XMLHTTP object to call the web service and get the XML back (ie. standard AJAX approach). The app fetches stock price data (plus a little more with the SOAP method) on the company that you select from the stock ticker list box. The app shows the data that is submitted and the data that is returned (generally an XML document) by each method. Simply select a stock ticker value from the list box and click on the relevant button to call each macro.

The web service used is http://www.webservicex.net/stockquote.asmx?op=GetQuote. If you navigate to this page in a web browser you will see how the web service documents the options for communicating with the service and the format of the data required to be sent and the fomat that will be received.

Please note that you must set module security to "Allow Any Macro" when prompted on opening the application.

29 Replies
Partner
Partner

Re: Call a web service via SOAP, HTTP Get or HTTP Post

How does it will work in AJAX client on various platforms (Microsoft, iOS, Android)? How about cross domain ajax requests?

Employee
Employee

Re: Call a web service via SOAP, HTTP Get or HTTP Post

Hi Alexander. The example is just using scripting to call a web service in three different ways, so it works in the AJAX client with no trouble at all. Although the script is vbScript, it is really an AJAX based approach. I have not tested it with mobile browsers, but it should work fine from them as well.

Employee
Employee

Re: Call a web service via SOAP, HTTP Get or HTTP Post

Sorry I am confused ... how could that work within the Ajax client? I have reviewed your code and the requests are realized using macros ... but macros do not work when using the Ajax client ...

Do I miss something in your demo?

Regards

Stefan

Employee
Employee

Re: Call a web service via SOAP, HTTP Get or HTTP Post

Hi Stefan

It is not correct that all macros do not work in the ajax client. Macros actually execute in the context of the QV application where it is hosted. So some client side macro functions will not work when the app is hosted on the server (and accessed via AJAX). One example is the exportEx() function - which will not work in a macro via AJAX, as the server cannot export content to a file on your local drive from. However there is a serverSideExportEx() function specifically for using with macros on the server which creates a file on a server directory.

So macros will work when the app is hosted on the server and the AJAX client is used, as long as you use the right functions. Download the attached app and try it. I just did exactly that using my own access point and AJAX client (albeit all running on my laptop) and it worked fine.

Partner
Partner

Re: Call a web service via SOAP, HTTP Get or HTTP Post

Works for me in AJAX!

I additionally had to enable "Server|Security|Allow unsafe macro execution on server" in the QMC!

Employee
Employee

Re: Call a web service via SOAP, HTTP Get or HTTP Post

Thanks for your answer!  Regards Stefan

Partner
Partner

Re: Call a web service via SOAP, HTTP Get or HTTP Post

Hello Lee, Thanks for this very greatful Macro.

Thanks

chrisbrain
Valued Contributor

Re: Call a web service via SOAP, HTTP Get or HTTP Post

For any QVSource users out there, we just wrote a tutorial/example showing how our web connector can be used to call a SOAP service:

http://www.qvsource.com/wiki/How-To-Call-A-SOAP-Web-Service-From-QlikView.ashx

As it's mediated by QVSource there is no use of QlikView macros and, depending on the response of the SOAP service, it can also be possible for QVSource to return a structured result table via QVX.

Not applicable

Re: Call a web service via SOAP, HTTP Get or HTTP Post

Can someone throw lights on the advantages of calling the webservice via Qlikview ?

A real time scenario would be helpful..