From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Web Development Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

RT Webservice folder location inside linux RT target

Solved!
Go to solution

Hi All

I am working with sbRIO9651, LV14. I use public folder underneath webservice to load a static webpage and dynamically update its contents with my measurement, using websockets. When a webpage is loaded, as per a URL call, the html webpage loads, with some numeric data, referred from an xml file kept in the same folder (through javascript). We would like to change the contents of the xml file programmatically, using the main VI. The problem is that the xml file path, located in '/var/local/natist/webservices/aws/xxxx/Public/', is not accessible through main VI, which, when accessed, says that the path does not exist.

Is this because of the symbolic link or permissions inside Linux OS? Where exactly are the webservice folders located inside the RT target? I had posted my query in labview forum, before coming across this group, and I thought my problem would suit here better.

Many thanks

Arya

0 Kudos
Message 1 of 9
(11,874 Views)

If you are using Chrome, you can push CTRL+SHIFT+I to pull up the inspect element. You can then go to the Console, and it will give you a list of where it's trying to load that resource from. This will give you some insight in to how to modify the path to make it work.

I could be wrong, but I'm pretty sure that the path where your web service is deployed is "/var/local/natinst/labview/www", which means that your web service is unable to access resources that are in a different hierarchy.

Tanner B.
Systems R&D Engineer - Aerospace, Defense, and Government
National Instruments
0 Kudos
Message 2 of 9
(8,963 Views)

Hey there,

I tried deploying a web service onto a linux RT target through an RT exe, but I did not see a "var/local/natinst/webservices/aws" folder on my system. Not exactly sure where the files are. Are you doing this from a project deploy or from RT exe?

What I do know is the files created in that temporary folder are exactly that. They are temporary. Any changes that you make to the file will be completely wiped when you restart the system. So if you are trying to make any permanent changes to the xml file, this is not the way to do it. If you are trying to make temporary changes, what is the purpose?

If you are trying to change the xml in order to change what is displayed on your webpage, I think there are much nicer ways of doing that. Since the javascript code is the one grabbing the data that needs to be changed in the xml file, why not directly feed the data to the javascript? You can create a GET method that the javascript code calls, and then the method can return xml or JSON to the javascript.

Daniel C.
Applications Engineer
National Instruments
0 Kudos
Message 3 of 9
(8,963 Views)

Hi all

Tanner, I load the xml page via an httprequest. And since the web application's context path is the directory which contains all the webservice files, it will be like the 'home' or root folder for the page, which for me does not return any path as all these are in the same folder. This will not be the absolute path for the VIs which I think are kept in home/lvuser/... I checked the www folder, it has few webpages, but I did not find any files related to my application there.

Dnchen, I publish the webservice first before making the exe (I think that is necessary), the specific folder inside aws is created when you publish it, and it gets deleted when you unpublish it. Surprisingly, the data inside does not get deleted even if you reboot the system (I checked). Now, I manually edited the xml file inside this folder and rebooted it, to see that the changes made exist even after rebooting, and the updated xml file loads now. What I want is to do this via VI, for which a path is necessary. We take the data from xml file by means of GET request as you have suggested.

I also came across this, which was actually giving me error, may be because I am not doing it the right way?., but gives some hope.

read service attribute.PNG

Thanks

Arya


0 Kudos
Message 4 of 9
(8,963 Views)
Solution
Accepted by topic author arya1

Arya,

I believe the VI runs under the lvuser on the cRIO, while the webDAV typically runs under admin. This might be why the VI cannot see the directory.

What I would suggest you do here is to place the XML file in a known directory outside of the web service. That way the VI will have access to the known directory.

Best,

-Daniel

Daniel C.
Applications Engineer
National Instruments
0 Kudos
Message 5 of 9
(8,963 Views)

Hi Daniel

Yes. I think that could be the way. But I will have to put the file inside webservice folder (or link it to webservice folder as I can give only a relative path to the javascript in the same folder). Found that the address book example shipped with LV does something similar, though most of the VIs are protected..

Thanks

Arya

0 Kudos
Message 6 of 9
(8,963 Views)

Hi Daniel

We did what you suggested. We put the xml file in a known location, which could be accessible by the VIs. Then made a webservice GET method VI which will output the xml values from this location when called. Now when the static page is loaded, javascript calls the webservice VI which will in turn send back the values to be displayed.

Thanks

Arya

Message 7 of 9
(8,963 Views)

Arya,

That's great to hear! We would love to have an example of this posted on the community. Feel free to create a new document and upload the code here:

https://decibel.ni.com/content/groups/web-services?view=documents

Daniel C.
Applications Engineer
National Instruments
0 Kudos
Message 8 of 9
(8,963 Views)

Sure Daniel! Our actual application cannot be posted as such, but I will create a replica of it and post it over the next few days.

Arya

Message 9 of 9
(8,963 Views)