Platform: sbRIO 9651, LV2014
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..??
Solved! Go to Solution.
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.
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.
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):
@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?
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.
Hi Sam, Milan
The updated project structure looks like this: