Example Code

Deploying a Web Service From a Host PC and a cRIO

Code and Documents

Attachment

Download All

Overview


This code is a simple example of deploying a webservice from a host PC, and a webservice from a target cRIO.  The user is suggested to use this to look at the differences in the proces of performing these action so they can utilize web services deployment on any platform.

Description


This code was originally created to show the differences between deploying a webservice from a host PC and then from a cRIO.  It's a good way to show how an end user can create their own web services in the same manner on either platform. 

Steps to Implement or Execute Code


  1. Deploy the code to your host PC and cRIO
  2. Go to a web client and go to "http://localhost:8080/hostPC/hostPC/10/10" where 10 and 10 are some number (the example will output C which is the sum of those two inputs.
  3. Compare the output from the host PC by going to "http://xxx.xxx.xxx.xxx:8080/targetcRIO/target/10/10" where the user will fill in the cRIO IP address and the 10 and 10 can be any number.

Requirements

Software

This code will work with LabVIEW and LabVIEW Real-Time module 2012.  There is a new procedure for using webservices in LabVIEW 2013.

Bobby Breyer
Applications Engineer
National Instruments

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

Comments
g_l_u_p
Member
Member
on

I was looking exactly for this!!!!!!

Could you publish it for LV2010?

ShishKeBobby
Member
Member
on

Sure!  I didn't check functionality for 2010, so be sure to use follow some tutorials on how to use Webservices on LV2012 and before (Webservices have changed in LV 2013).

Bobby Breyer
Applications Engineer
National Instruments
g_l_u_p
Member
Member
on

Thanks ShishKeBobby!

I'm trying it right away. I'll let you know how it worked....

g_l_u_p
Member
Member
on

Hi again ShishKeBobby! Everything worked on 2010

I'm planning on having a cRIO with a web UI, so I'm now starting to think on how to share data between my RT application and the Web Services running on my RT.... Do you have any experience in this?

ShishKeBobby
Member
Member
on

Hi g_l_u_p,

I just noticed you replied! Sorry for the extemely delayed response.  Yes, your webservice and your application can communicate.  You need to use TCP to communicate between the two items though, even if they're hosted on the same machine.  This is the easiest way to accomplish communication between the two.  In 2013 this is changed and is more straight forward (my opinion).

Hope that helps.

Bobby Breyer
Applications Engineer
National Instruments
da.martinez
Member
Member
on

Hi guys.

I am trying to communicate a web service with labview, it could be by Host PC or cRIO, the problem is that I don't have much experience with this and I have some troubles.

Firstly, I am working with labview 2012 and I used the assitant to create the web service communication (Tools»Import»Web Service… to launch the Web Service Import Wizard); and I used a WSDL URL and it creates the methods of the web service. But now this WSDL URL is not working and the web service support suggest me to do a local probe with the file of the contract service (.wsdl file) of the web service, in programs like SOAP UI is just locate the file directory in the PC and it works but with labview I don't know how to load this file, do you know how can I do it?

The second is that labview creates three methods of the web service (Open, Crear Lotes (write), Close). In Crear Lotes method I have to send the data to the web service and I invoke nodes to select the class and write in it, but the type of the class is 1D array .NET Refnum and I don't know how to send data like double, strings, etc... also I create a constant 1D array .NET Refnum but appears error in the connection. I upload the vi if you can suggest me something to do, please.

I will be grateful for your help, Thanks!!local web service local.jpg

error dato web service.jpg

Contributors