From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-12-2020 07:58 AM
Hi All,
I'm trying to access and read network shared variables from web using the instructions given in LV help.
http://zone.ni.com/reference/en-XX/help/371361R-01/lvhowto/vws_reading_a_variable/
I'm send the request as follows, but cannot get the value.
I've created couple of variables, deployed them and continuously updating their values on the target. I can successfully read those variable in LV host application, but cannot get them as described in the corresponding help instructions.
Any help is appreciated.
Thanks,
Arev
01-14-2020 12:35 AM
Does anybody know some other solution to get data without websocket from RT target in the Web?
Thanks,
Arev
01-14-2020 03:55 AM
You can use Open Variable Connection, Read Variable, Close Variable Connection.
Not sure if that uses websockets? What is the goal?
01-14-2020 04:47 AM - edited 01-14-2020 04:48 AM
Thank you for for your reply.
Actually I need to get shared variable data not in the LabVIEW environment, but web.
I need to get the value with HTTP Get command. In the help the command is described as follows, but I cannot get it to work.
I'm using Postman to send the request and get response, but never get it.
Thanks,
Arev
01-14-2020 05:13 AM
You can give curl a try. I think it's build in, at least in my Windows 10, but probably earlier as well.
Although I don't see why the results would be different, it would be a 2nd opinion.
You should also be able to use that URL in a browser. IIRC, you can remove parts from the end of the URL, and get a higher level response. So you might be able to remove from the URL until you get anything, and than build up the URL small steps at a time.
A ping would rule out any network problems.
I'll do some digging, I'm sure I did this a while ago. But most recently I did it for SystemLink, which is similar but with variation on the URL. I'd think the URL is the biggest problem here. I'm sure I put a link to useful info somewhere...
01-14-2020 08:34 AM
I have tried with the browser as well, but got the same result.
Also the Postman is running Curl inside, so it is also not helping.
I'm getting the following response:
<!DOCTYPE html>
<html><head><title>Not Found</title></head>
<body>
<h2>Access Error: 404 -- Not Found</h2>
<pre>Cannot open document for: /nivariable/VariableValues(%27ni.var.psp://169.254.141.232/NSV/Status%27)/Value</pre>
</body>
</html>
01-14-2020 09:30 AM
I used (from localhost) this in the past:
http://localhost:3580/nivariable/VariableValues('ni.var.psp://localhost/EtherCAT Master/Mod3/DI1')/Value
So IIRC, port 8080 is used for HTTP, but not for the shared variable engine. 3580 is probably default.
01-14-2020 10:03 AM - edited 01-14-2020 10:08 AM
I have tried to create and deploy shared variables on Host PC as well, and tried to get their values as:
GET http://localhost:3580/nivariable/VariableValues('ni.var.psp://localhost/NSV/Status')/Value
But again the same error, both with the Postman and browser. Still cannot figure out what is the issue.
01-14-2020 10:09 AM - edited 01-14-2020 10:10 AM
Are there any settings for the shared variable that maybe I'm missing, or perhaps some software on the target?
01-14-2020 10:16 AM
Do you get anything with:
curl "http://Admin:@localhost:3580/nivariable/"
(Admin, "" as credentials) or
curl "http://localhost:3580/nivariable/"
I get XML:
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<service xml:base="http://localhost:3580/nivariable/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app">
<workspace>
<atom:title>Default</atom:title>
<collection href="VariableObjects">
<atom:title>VariableObjects</atom:title>
</collection>
<collection href="VariableValues">
<atom:title>VariableValues</atom:title>
</collection>
<collection href="VariableValueGroups">
<atom:title>VariableValueGroups</atom:title>
</collection>
</workspace>
</service>
Any other request I get """ does not have permission to read VariableValues".