LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Web method vi to change web server config

Solved!
Go to solution

I have a web method vi (login.vi) to receive data from web browser form.Once the username and password match, client IP will be added to web server's TCP/IP access list.

 

But the App property doesn't work. Anything I missed?

 

Thanks.

 

login.png

0 Kudos
Message 1 of 10
(3,891 Views)

well, I think it did work but not worked as the way I expected.

 

The application name of the web method vi and web server config file path are

 

ApplicationWebServer.exe
C:\Program Files\National Instruments\Shared\NI WebServer\niwebserver.conf

 

What I wanna programmatically change is the web server for the remote front panel, the application name and web server config file path are

 

LabVIEW.exe
C:\Program Files\National Instruments\LabVIEW 2011\niwebserver.conf

 

I tried to assign a port number for the vi server from project option dialog box and open an applicaion reference as shown below, but it did not work,

viserver.png

how can I donfig remote front panel web server from a web method vi?

Thanks.

 

0 Kudos
Message 2 of 10
(3,860 Views)

Hey Eric,

 

I'd like to hear more about how your VI works, and what is going wrong, if you could give me some information about what you have done to troubleshoot it so far I think I can help you find out how to fix it.  

Regards,

Eric L.
Applications Engineering Specialist
National Instruments
0 Kudos
Message 3 of 10
(3,825 Views)

Eric, 

 

Thank you. Let me simply descript my situation.

 

I built a web service which includes a static document start.html (http://localhost:8080/myservice/start.html) and a web method vi login.vi (/myservice/login)

 

The start.html contains a form and the data will be posted to login.vi. The browser then will be redirected to a web published remote front panel Main.vi (http://ipaddress:8000/main.html).

 

Before redirection, I just wanna add client computer's ip address to remote front panel web server's TCPAccess List, and add Main.vi to visible VI list.

 

I used application property to write these lists, but as my I said in last two posts, it did not write to the remote front panel's web server config.

 

Hope it can help you understand my question.

 

Thanks.

0 Kudos
Message 4 of 10
(3,818 Views)

You'll need to use VI Server to have your application web server connect to the main LabVIEW instance (the one that's running your VI) and remotely execute a VI that updates the web server properties for that instance.  The web server runs in a separate application instance; you need to set the properties in the application instance in which your VI will execute.

Message 5 of 10
(3,812 Views)

Nathand,

 

Thank you for reply.

 

I configed VI Server and named it as MainApp/VI Server, added "*" to machine list and exported vi list. Then open application reference to change application properties as shown below, it didn't work.

 

222.png

Then I moved app properties config to a seperate VI, say, ConfigWebSer.vi, and proceeded as shown below, still did not work.

11.png

 

did I miss anything?

 

Thanks.

0 Kudos
Message 6 of 10
(3,800 Views)
Solution
Accepted by Eric_LZ

I recommend that you take advantage of the error terminals, and read the documentation for the functions you are using.  You've wired "MainApp/VI Server" to the "machine name" input of Open Application Reference, and that's almost definitely not a valid machine name.  You will probably need to use TCP to connect between instances, even on the same machine, so you'll need to configure VI Server to listen for TCP connections on a specific port in your project, and then connect to that port.  Also, connect the error wires between functions, and put an indicator at the end so you can see when errors occur.

Message 7 of 10
(3,790 Views)

Thank you Nathand, you are really appreciated. I changed service name to IP address and port on the second procedure shown above, it now working fine.

 

port.png

 

The only thing is the vi path of Open VI Reference.vi has to be a complete path

 

I tried this, but it did not work.

port.png

0 Kudos
Message 8 of 10
(3,786 Views)

Eric LZ wrote:

The only thing is the vi path of Open VI Reference.vi has to be a complete path

 

I tried this, but it did not work.

port.png


This only works if the VI ("ConfigWebSer.vi" in your case) is already loaded in memory.  I'm guessing that the only time you call ConfigWebSer is through VI Server, so it's loaded when you make the VI Server call and unloaded when it finishes running.  If you want to keep it in memory so that you can reference it by name rather than path, put a static reference to that VI inside your Main VI (the one that's running continuously).

Message 9 of 10
(3,776 Views)

Nathand, you are expert.

Done. Thank you so much.

 

Can you help me about another problem?

 

http://forums.ni.com/t5/LabVIEW/method-not-allowed-http-405-error/td-p/1750564

 

Thanks.

0 Kudos
Message 10 of 10
(3,769 Views)