Example Code

Web Services in an RT executable - using LabVIEW Real-Time

Code and Documents

Attachment

 

Overview

This project demonstrates how you can run a web service on an RT target in an executable.

 

Description

Running a webservice on an RT target is relatively straight forward in the development environment, but doing it in an executable used to be more difficult.

The new web services introduced in LabVIEW 2013 have made the process of deploying web services in executables very straight forward for RT targets.

 

Requirements

  • LabVIEW 2013 or compatible, with Real-Time module;
  • cRIO, RT-PXI or RT-desktop

 

Steps to Implement or Execute Code

  1. Open the attached project
  2. Connect to an RT target
  3. Right click "TargetService" web service and click "Start." This will start the web service in the development environment.
  4. Right click "TargetWebEXE.vi (GET)" and select "Show Method URL"
  5. Copy the web method URL and paste it in a browser.  You should see Zulu time and date according to your RT system
  6. Close your browser and stop the TargetService web service
  7. Right click "My Real-Time Application" in the Build Specifications and select "Build"
  8. Right click "My Real-Time Application" and select "Run as startup"
  9. Go to the same web address as step 5., except change the port to 8002.  You should see the time stamp running as an RT EXE.

 

Additional Information or References

8.png

**This document has been updated to meet the current required format for the NI Code Exchange. **

 

 

 

Bobby Breyer
Applications Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
srm@viewpointusa.com
Active Participant
Active Participant
on

after deploying the application with web services, i try to connect to the target with the development environment.  the RT application is able to download and run but when i start the web service, the code is downloaded but i get the message "Error LabVIEW:  (Hex 0xFFFEFA27) LabVIEW Web Services: A Web service already exists with the input name."

how do you overcome this?

Stu
ShishKeBobby
Member
Member
on

Hey srm,

The web service should start automatically after deploying the application. You should just connect using this URL: http://127.0.0.1:8002/TargetService/TargetWebEXE

Change the bolded IP address, and port to match your settings. Go to a web page and paste in the updated URL and you should see a time stamp.

-Bobby

Bobby Breyer
Applications Engineer
National Instruments
ShishKeBobby
Member
Member
on

Following up:

Right click the webservice > application web service > unpublish. This should allow you to start you web service from the development environment.

Regards,

Bobby

Bobby Breyer
Applications Engineer
National Instruments
srm@viewpointusa.com
Active Participant
Active Participant
on

Thanks Bobby,

did you replicate this?  I got an error message "failed to unpublish" when i tried it.

I still have to unset run at startup, deploy and reboot in order to work/start web services with dev system again.

Stu

Stu
ShishKeBobby
Member
Member
on

Hey Stu,

I did replicate the issue and solved it with the above steps, though I think I may be using different hardware and software versions. I am using LabVIEW 2014. Let me test this again with your software/hardware. What version of LabVIEW and what kind of controller are you using?

-Bobby

Bobby Breyer
Applications Engineer
National Instruments
srm@viewpointusa.com
Active Participant
Active Participant
on

LV 2013 SP1.  i would believe that it may have been fixed in LV2014.  if so, don't worry about it and i will continue to work around in 2013.

Thanks again.

Stu
Tinnotek
Member
Member
on

 I got the same message "Error LabVIEW:  (Hex 0xFFFEFA27) LabVIEW Web Services: A Web service already exists with the input name." in LabVIEW 2014 SP1 and 2015. It seems that Bobby's workaround is the only way to start up the debug mode.

 

Thanks all,

 

Ting