Jump to content

Slightly off-topic: Web page help w/ LabVIEW services


jed

Recommended Posts

I have written an app for a client and included a couple web services to pull some data. Works great.

I was wondering how difficult it is to design a simple web page that can take advantage of the web services; Specifically, how hard is it to have the user click a form button, have that call the web service and then pull data out of a specific XML field and update the page? I know this could get pretty involved, but basically I was hoping to write a simple web page with a table and update values in the table from the web service; I was hoping NOT to have to do this down at the labview level- although that might be what I have to do.

-jed

Link to comment

I have written an app for a client and included a couple web services to pull some data. Works great.

I was wondering how difficult it is to design a simple web page that can take advantage of the web services; Specifically, how hard is it to have the user click a form button, have that call the web service and then pull data out of a specific XML field and update the page? I know this could get pretty involved, but basically I was hoping to write a simple web page with a table and update values in the table from the web service; I was hoping NOT to have to do this down at the labview level- although that might be what I have to do.

-jed

Easier than you might think.

Just attach the updateData to a button Onclick event.

Link to comment

Easier than you might think.

Just attach the updateData to a button Onclick event.

I'm not sure if it is that easy. I am pretty sure the web page must be hosted as a static document in the web service. Most modern browsers (Firefox, Chrome, and maybe IE) prevent cross-server requests, which have the potential to be dangerous. I would start by making a hello world HTML document then staticly adding it by following these directions http://zone.ni.com/reference/en-XX/help/371361G-01/lvhowto/ws_static_content/.

Then you can use ShaunR's information. If you really want to do an AJAX call simply I would look over jquery library. That is how I learned basic web page development.

Link to comment

Hi Jed,

One option that you can try out is the new LabVIEW Web UI Builder software that NI released late last fall. It's a web-based product that lets users develop web-based UIs that talk to LabVIEW web services. The way you develop in Web UI Builder is very, very similar to developing an application in LabVIEW (rich front panels, graphical block diagrams, etc.). The software is free to try out; you only have to buy a license if you want to build and deploy your application.

Web UI Builder homepage

Regards,

Mike Neal

LabVIEW Product Manager

National Instruments

Link to comment

I'm not sure if it is that easy. I am pretty sure the web page must be hosted as a static document in the web service. Most modern browsers (Firefox, Chrome, and maybe IE) prevent cross-server requests, which have the potential to be dangerous. I would start by making a hello world HTML document then staticly adding it by following these directions http://zone.ni.com/r...tatic_content/.

Then you can use ShaunR's information. If you really want to do an AJAX call simply I would look over jquery library. That is how I learned basic web page development.

I cannot read that document at the moment - NI down again (might have read it in the past though). But from experience, most uses of the NI web server are to make VIs available internally within a company (managers and engineers looking at production etc - Intranet). therefore x-server really isn't an issue. When/if external access is required, usually IT insist that any requests are routed through their main servers anyway, so the browser requests it from a page on the corporate site and the request to the NI web server is sent from the corporate site. So the content seem to come from the same (corporate site) domain as far as the web browser is concerned..

Edited by ShaunR
Link to comment

I cannot read that document at the moment - NI down again (might have read it in the past though). But from experience, most uses of the NI web server are to make VIs available internally within a company (managers and engineers looking at production etc - Intranet). therefore x-server really isn't an issue. When/if external access is required, usually IT insist that any requests are routed through their main servers anyway, so the browser requests it from a page on the corporate site and the request to the NI web server is sent from the corporate site. So the content seem to come from the same (corporate site) domain as far as the web browser is concerned..

I'll yield that you know best. I know x-server has gotten me in the past, but I would not call myself a web-savvy developer. More a dabbler.

Link to comment

I'll yield that you know best.

Probably not..lol.

I don't have much experience with streaming from the NI webserver (for example). I prefer other methods like TCPIP or websockets for that - they don't have such issues and (IMHO) offer better performance. But for normal HTTP requests (on the server side) it can be as simple as a PHP script on the corporate server that uses cURL to resend the request to the NI server and relay it back to the browser (easier than trying to get proxies and stuff authorised and set up by IT). As such, the corporate server is indistinguishable from a browser as far as the NI web server is concerned (and if you want , you can do caching and stuff too). It keeps IT happy since their portal is still the entry point and secure behind their firewalls and security policies, It obviously has an impact on performance - but it's not much for get/post methods through an Intranet, It also makes aggregation of multiple LabVIEW machines a breeze. It's one of the few scenarios where IT are actually useful biggrin.gif

Edited by ShaunR
Link to comment

I'm not sure if it is that easy. I am pretty sure the web page must be hosted as a static document in the web service. Most modern browsers (Firefox, Chrome, and maybe IE) prevent cross-server requests, which have the potential to be dangerous. I would start by making a hello world HTML document then staticly adding it by following these directions http://zone.ni.com/r...tatic_content/.

Then you can use ShaunR's information. If you really want to do an AJAX call simply I would look over jquery library. That is how I learned basic web page development.

Website is back so, so read the page. From what I could see, the OP must have already done that as it is working.

I'm ot not really sure if x-domain is relevant to that anyway. All the XMLHTTPRequest would be doing is sending a "GET" to the server on the same domain as the page was served (just as if the page was refreshed....but without refreshing it). It's not as if it would be opening an 3rd party site in an IFRAME (which is where you get problems).

I'd be interested to learn what problems you encountered and (probably more importantly) what you did to get round it.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.