Jump to content

Screenshot Web Service


Recommended Posts

I have created a project that builds and deploys a web service to a target machine that does not have the LV dev suite installed.

I used some information on the NI site and some support from NI people to make this work.

The web service not only demonstrates how to do this but also has some useful features:

1. Takes screenshots on demand of target machine.

2. Can get VI panel images of any VI running on the target machine.

3. Shows how to call a LV web service from another LV app.

I hope you find this project helpful for learning about LV web services and as a tool for remotely monitoring your applications.

(I use this to check the status of my test system from my iPod Touch!)

Please let me know if you find any bugs or have any suggestions for improvement.

-John

Project:

Download File:post-2411-1234913566.zip

Readme:

Download File:post-2411-1234913620.pdf

Link to comment

QUOTE (Ton @ Feb 18 2009, 09:58 AM)

Sure, but doesn't it need to pass some sort of review before it can be posted there? I thought this forum was where we posted things that might qualify and then the 'reviewer' can give it their approval before we submit it.

What is the proper process for getting someting into the CR? I'm happy to follow it.

-John

Link to comment
  • 2 weeks later...

Hi John,

Thanks for posting this example.

I tried installing the web service using 'with RTE' installer in PCs not having LabVIEW. In some PCs the installed web service failed to work while in some other PCs it is working perfectly. Is there any way to check why it may not be working in some PC? I have enabled all the ports mentioned in the PDF document and even tried disabling the firewall. Still no luck.

Thanks

Link to comment

QUOTE (Kal @ Mar 5 2009, 05:32 AM)

Hi John,

Thanks for posting this example.

I tried installing the web service using 'with RTE' installer in PCs not having LabVIEW. In some PCs the installed web service failed to work while in some other PCs it is working perfectly. Is there any way to check why it may not be working in some PC? I have enabled all the ports mentioned in the PDF document and even tried disabling the firewall. Still no luck.

Thanks

I would first test it with the 'echo' service built into the web server. If that does not work, then you have some sort of networking issue. Call your IT guys. There might be a hardware firewall in the path between your server and client.

If the echo test does work, then I would investigate the VI server ports on the EXE running on your server target. You need to have the EXE's ini file set to enable VI Server on the default port if you want to grab the front panel of a VI. To grab a screenshot, the screen must be rendered (someone must be logged in and looking at the screen). And the screensaver cannot be running.

Another thing to look at is the Distributed System Manager on the server machine. This will let you peek at the status of your web server to see if it is running. Call NI for support on this tool. It should have been installed with the RTE files.

Hope this helps. Good luck.

I will try to get around to posting a new version of this with some enhancements soon. One thing I added was the ability to point to different EXEs on the target server, as long as each of them uses a unique VI Server port. Keep watching this space... ;)

Link to comment
  • 1 month later...

Major upgrade!

I have changed the project so that it creates a windows service. I have also renamed it to:

NI Web Service Server

This is more of an 'engine' that keeps the web server running all the time. So, now your other projects do not need to install/run the web server. Instead, all they need to do is place their web service LVWS file into the 'install' directory and the web server will deploy them automatically.

I am still including the web service that allows you to take screen shots of your target machines as well as retrieving images from VI panels or your EXEs. This now works with multiple EXEs by allowing you to specify the VI Server port that the EXE is listening on.

And I added a new web service that can get the version number of your EXEs.

We use these web services on all our deployed machines to be able to do remote support and to query the installations for maintenance tracking.

I hope you find this useful. There is a lot of power in the new web services once you sort out the gory details. I hope this example helps show the way.

-John

Download File:post-2411-1240260082.zip

Link to comment

QUOTE (jlokanis @ Apr 20 2009, 10:42 PM)

Major upgrade!

I hope you find this useful. There is a lot of power in the new web services once you sort out the gory details. I hope this example helps show the way.

Wouwaw Professor! I bow to you!

This is solving all online support issues. Thanks!

Link to comment

One note of caution, I have discovered that if you place a new LVWS in the install folder while the web server is running that it will get deployed BUT it will not run until you stop the web server and then restart it. This is counter to what NI told me. So, use the 'Stop NI Web Service Server' before installing new LVWS files into the install folder and then use the 'Start Web Service Server' to restart the service afterwards. Also be sure to cleanup the old deployments while the server is stopped.

-John

Link to comment

QUOTE(jlokanis @ Feb 18 2009, 03:53 PM)

Sure, but doesn't it need to pass some sort of review before it can be posted there? I thought this forum was where we posted things that might qualify and then the 'reviewer' can give it their approval before we submit it.

What is the proper process for getting someting into the CR? I'm happy to follow it.

-John

Hi John!

VERY NICE JOB!

It will be very usefull for me.

I would like to remember it will work just in Windows in English language because of the path in BAT, INI and TXT files.

I believe it should be usefull to put an explanation file teaching the code in files we need to change if you use another windows language, like me (portuguese), the path must be changed in some files.

I´ve already change the paths and the my webserver Is already online.

I´m still trying to use It correctly, but I still couldn´t. I appreciate If you could help me somehow.

I have already put the webserver up, the "echo" works well, but I still couldn´t have the print screen and front panel in my browser.

I have doubts about how to use it.

I have some exe files, and i would like to see remotly. So, what do I need to do with this EXE file?

Where should I need to reference it?

Do I need to put it in an especific Path?

Am I need to do a LVWS to put in any directory?

These are my doubts.

My e-mail address is mariano@grameyer.com.br, I appreciate very much if somebody could help me to put all working.

Link to comment

QUOTE (Mariano Gauderio @ Apr 23 2009, 04:38 AM)

I would like to remember it will work just in Windows in English language because of the path in BAT, INI and TXT files.

I believe it should be usefull to put an explanation file teaching the code in files we need to change if you use another windows language, like me (portuguese), the path must be changed in some files.

I´ve already change the paths and the my webserver Is already online.

I´m still trying to use It correctly, but I still couldn´t. I appreciate If you could help me somehow.

I have already put the webserver up, the "echo" works well, but I still couldn´t have the print screen and front panel in my browser.

I have doubts about how to use it.

I have some exe files, and i would like to see remotly. So, what do I need to do with this EXE file?

Where should I need to reference it?

Do I need to put it in an especific Path?

Am I need to do a LVWS to put in any directory?

These are my doubts.

My e-mail address is mariano@grameyer.com.br, I appreciate very much if somebody could help me to put all working.

As for language issues, I don't know anything about customizing software for non-English versions of windows, so you are on your own.

Since you say the echo test is working, that means that the web server is running AND the web service has successfully been deployed. So, that is good.

In order for your LabVIEW built EXE to be viewable by the web service, the EXE must have VI server enabled. Also, you need to know what port VI Server is set to. The default it 3363. If you use a different port, then you must specify it in the web service call. Do not use 3364 since that is what the web server is using.

Here is an example of the things that must be in your EXE's INI file for the VI server interface to work:

server.tcp.enabled=True

server.tcp.acl="290000000A000000010000001D00000003000000010000002A10000000030000000000010000000000"

server.tcp.access="+127.0.0.1"

server.tcp.port=3363

You do not need to specify a path to your VI that you want to get the image of since it is already in memory. You do need to enter it's name correctly, however.

Another thing you can try is the screenshot web service call. If that works, you can at least prove you can stream MIME types from you machine to your client. If that is not working, then you have IT issues (firewalls, etc). I can't help much with that either.

There is no need to build an LVWS file to use the services I have already created. The project already does that for you. If you want to make more web services for other uses, then you would create your own LVWS and place it in the install directory.

Hope this helps. Good luck!

-John

New version with minor tweaks. You no longer need to stop and start the service when updating. Also, the wscleanup batch file now does this for you when installing your own LVWS files.

And I updated the PDF. If I have to type 'web service server service' one more time, I might go insane...

-John

http://lavag.org/old_files/post-2411-1240533082.zip'>Download File:post-2411-1240533082.zip

Link to comment

Hi John!

Thanks a lot for your contribuition and to new version of the web server service.

I´m sorry, my english is not so good. Could you explain me in details this phrase please.

"You do not need to specify a path to your VI that you want to get the image of since it is already in memory. You do need to enter it's name correctly, however."

In my case I use just EXE files, so I understood I have to put the EXE name (ex. http://localhost/screenshot/get_panel/png/test.exe), or this service works just to VIs are In development?

I thought I couldn´t "reach" the name of the VI If I built an EXE file, am I wrong?

I build a simple EXE file (test.exe) and the name of the vi is test.vi.

Anyway I tryied and i couldn´t see the panel of the VI this way (http://localhost/screenshot/get_panel/png/test.vi) even (http://.../test.exe).

Link to comment

Yet another update. Fixed two bugs:

1. The wscleanup.bat file had an error. Debugging code was accidentally left in so it was not doing anything. This new version should fix that.

2. The screenshot function no longer worked now that I changed the server to be run as a windows service. This is because it was not associated with any user who has a screen to render. So, this new version has the web service VI call out to any EXE that the user is running and runs the screen grab code in that user's app instance. The caveat is the user EXE must have the 'get local screenshot.vi' embedded and in memory so it can be used by the web service. I am open to better solutions to this if you have any.

Download File:post-2411-1241054615.zip

-John

Link to comment

QUOTE (jlokanis @ Apr 29 2009, 09:24 PM)

2. The screenshot function no longer worked now that I changed the server to be run as a windows service. This is because it was not associated with any user who has a screen to render. So, this new version has the web service VI call out to any EXE that the user is running and runs the screen grab code in that user's app instance. The caveat is the user EXE must have the 'get local screenshot.vi' embedded and in memory so it can be used by the web service. I am open to better solutions to this if you have any.

You can bind the service to a user account (instead of the default Local System Account) which should give you access without needed to include that VI ... but I've never had to configure service logons programmatically.

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