LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

when there is web service request, we need to write to text file

Hello, Im currently using a web service request (particularly the read request variable). What my application does is that when a user enters the url

 

http://127.0.0.1:8001/WebService/Process?1=1&2=0&3=1&4=0&5=0

 

LED 1 and 3 turns on, while the other LEDs are turned off. I would like also to keep text file logs on what is the current time now, and the status of the LEDs. I want only to write to the file everytime the user enters the query in the URL (I dont want to write the logs every second or so, just only when the user presses the go button in the browser) 

 

I can now write to a text file the current datetime stamp, and already setup the web services. But I cant figure out how can I execute this write process everytime the user fires up a web request.

 

Basically, how can I write to a text file the status of the LEDs each time there is a URL request? 

 

Attached is the project. Thanks

 

 

0 Kudos
Message 1 of 9
(3,434 Views)

In the web service you have a VI that executes when the url is called. Put the logic there to write the required information to the file.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 9
(3,386 Views)

@mike, Ive putted the write logic inside the VI, and it doesnt execute whenever I fire a web request.

 

ss (2014-09-08 at 02.27.36).png

0 Kudos
Message 3 of 9
(3,378 Views)
What errors are you getting?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 9
(3,368 Views)
No errors but when i look at the text file, it doesnt get written but the LEDs lights on and off
0 Kudos
Message 5 of 9
(3,354 Views)
You can try it , ive uploaded the project files in the first post
0 Kudos
Message 6 of 9
(3,353 Views)
One reason you might not be getting any errors is that you aren't looking for errors. Connect up the error clusters and then display what you get.

Where are you getting the path that you are writing to?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 9
(3,334 Views)
@Mikeporter

The path im writing to is my desktop. im writing a text file
0 Kudos
Message 8 of 9
(3,289 Views)

I believe the default for open file is 'open', not 'create'. If that is the case you are definitely getting an error, and you just are not checking for it or handling it.

 

I'd also recommend against the idea of logging directly from the web method. If you ever decide to add additional methods it would be easier to send log commands to a central vi. take a look at startup vis.

0 Kudos
Message 9 of 9
(3,274 Views)