LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RT webservice folder location inside RT target

Solved!
Go to solution

Hi

 

Platform: sbRIO 9651, LV2014

Application: An application which loads static html webpage. The html page receives numeric data to be displayed through a javascript file, which loads data stored in an xml file put in the same folder. All these files are kept under 'public content' underneath webservice.I would like to know the actual location of the webservice public content folder so as to make changes to the .xml page through a labview VI.The next time the html page loads, it will be the new numeric values which will be loaded.

pjct structure.PNG

Though any VI iniside the target says its location as 'home/lvuser/natinst/bin', I guess the location of the webservice folder is different. After searching through the folders inside the target (using webDAV), I came to a folder '/var/local/natinst/webservices/' which when accessed through labview to rewrite the xml page, says that the file path does not exist.

 

Where exactly are all the webservice files located? I would like to get the actual file path to given to the VI to overwrite the xml file. There is a webservice.lvws file created when a run as startup exe is created. I guess this file points to the location of the entire webservice in the target..??

 

Thanks

Arya

0 Kudos
Message 1 of 7
(3,435 Views)
Solution
Accepted by topic author arya1

I suspect that this won't be trivial to do. On Windows 7, Web Services are stored in 'C:\ProgramData\National Instruments\WebServices\aws\' and inside there is a folder for each web service you have deployed. The folder name is something like '<webservicename>-<long string of hex characters>'. Inside that is a 'Public' folder which contains my static files. You could try to find the file/folder to get the path. I'm also not sure if LV loads the file into memory when the Web Service initialises which might mean it won't get updated. If you re-deploy your web-service, the file will get overwritten if it's deployed by the web service.

 

Why don't you create a Web Service VI that dynamically loads it's content from a file located somewhere else on the sbRIO and outputs it? Then your VI can edit the file and the web service VI can display/output it.

 

 


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 7
(3,424 Views)

Hi Sam

 

Exactly! ..and I found the folder which you were mentioning, under 'var/local/natinst/webservices/aws' in my RT target. The problem is that, when I try to access this location programmatically, through VI, it says that the path doesnt exist. Even 'list folders/files.vi' shows that aws folder is empty, whereas in actual, I can see the folders that I have published through the project using webDAV. Now I manually edited the xml file in the folder through webDAV, and the updated numerals were displayed in the html, even after reboot. So, now I know where to edit. Only that I am not able to access it through VI, which says the folder is empty and path doesnt exist. Either I dont have the permission to view the file (which i dont think is the issue) or the acutal path is somewhere else (the one shown in webDAV might be a symbolic link made in the linux OS). 

 

Also, my actual application is a bit complex than this. Actually, the file rewrite is only a small portion of the application. I made a small VI out of it, just to explain it in the forum. Along with the webservice, I actually have numerous VIs and subVIs which run to acquire data and process it. So, I am not sure about the solution that you suggested.. But I will try and let you know. 

 

Thanks for the quick reply.

Arya

0 Kudos
Message 3 of 7
(3,402 Views)

Hi Arya,

 

It sounds like you are trying to edit the static content of the web pages at run-time. Not sure how easy it will be, but it is also working against the grain. The static content is intended to be served statically (i.e. not dynamically generated). There are a couple options for dynamic content:

 

Server-side generated dynamic content (puts more burden on the RT target to generate HTML):

In your html you include small scripts (ESP). The scripts can be used to replace the values in the HTML that is generated with your current data from LabVIEW. See the following for more info: http://www.ni.com/white-paper/7738/en/

 

 

Browser-side retrieval of dynamic content (puts more burden on the web browser to update HTML):

Your static content is HTML and JavaScript. The JavaScript is run in the users web browser, retrieves the current data from the LabVIEW web service, and updates the HTML on the page. See the following for more info: https://decibel.ni.com/content/docs/DOC-41611

 


Milan
0 Kudos
Message 4 of 7
(3,384 Views)

Hi All

 

@Sam: I tried the solution that you have mentioned, by making a startup VI in the webservice, which will read an xml file somewhere else and write it to the folder where the static contents are located. To avoid ambiguity, i used relative paths instead of absolute paths, (according to the folder structure that LV webservice creates once it is published, pls refer to the attached image). Even now, the xml file is untouched. Isnt this that you have suggested? or have I missed something?

 

@Milan: The content will be static, only that, when the page is loaded, the file that refers to, to fill numeric columns need to be changed during its last run. I went through the links that you have suggested. From what I understand, ESP will help you to script inside your html page, but our problem is that the javascript points to an xml file to load its contents to the html page and we want to access this xml page through our VIs to be overwritten. We also have dynamic content in our page, and we update it by means of websockets, suggested by Sam..

 

Thanks

Arya

0 Kudos
Message 5 of 7
(3,351 Views)

Hi All

 

I came across this inside the labview help files, this might help me here, but I am repeatedly getting error for this, (may be because I am not doing it right).. Will check again and reply to the thread. 

 

read service attribute.PNG

 

Thanks!

Arya

 

0 Kudos
Message 6 of 7
(3,314 Views)

Hi Sam, Milan

 

We placed the xml file out of webservice, in a known location (inside /home/lvuser/..), which is accessible by the VIs, then made a webservice VI which will read the xml values from this location. While the static html page is loaded, the javascript will call this webservice VI to pass the latest numbers to be displayed on the file.  @Sam , thanks a lot for the suggestion!

 

The updated project structure looks like this: 

updated_pjct structure.JPG

 

Thanks

Arya

0 Kudos
Message 7 of 7
(3,268 Views)