LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling the RESTful reply prefix

Solved!
Go to solution

I'm working on a web service application.  The client (PC) polls the host (cRIO) periodically to obtain the status of some analog inputs.  The reply from the host is

 

values=[[0,0.047],[1,0.001],[2,0.027],[3,0.006],[4,-0.004],[5,0.032],[6,0.011],[7,-0.004]]

 

My client software would like the response to be

 

[[0,0.047],[1,0.001],[2,0.027],[3,0.006],[4,-0.004],[5,0.032],[6,0.011],[7,-0.004]]

 

without the values= prefix.  Is there any way to control that?  I have my source file output type set to Text in the build specification.  I've tried XML and HTML but those don't help.  I also tried renaming my block diagram terminal to null but that breaks things.

0 Kudos
Message 1 of 6
(2,698 Views)
Solution
Accepted by topic author kc64

How are you building your string? When I sent a simple string constant using the server code below, I get just that value back. What client do you use to retrieve the data?

 

web service.png

 

Cheers, 

Misha
0 Kudos
Message 2 of 6
(2,694 Views)

[Are you using the new png feature?  How does that work?]

 

My code looks like this.  The build spec maps the URL to this VI and the output is sent back.  My client is a browser web framework that issues the request to the cRIO and displays the results.

0 Kudos
Message 3 of 6
(2,686 Views)

Ok, it look like you're using the terminal method as opposed to the stream method... Let me see if I can reproduce this...

 

Are you using Labview 2009?  You can find out about the new PNG VI snippet feature here. Basically you can drag and drop the images of code onto your block diagram!

 

Again, how are you invoking the web service and getting the information? 

Misha
0 Kudos
Message 4 of 6
(2,683 Views)

I see what you're talking about. For now, I don't immediately see any options that will allow us to eliminate the name of the output terminal from the resulting string, but depending on how you're retrieving the information, you can parse that part out. For example you can use datasocket to invoke your web service with this connection string: 

 

http://ip_address/service_name/VI_name/input1/input2/[text]

 

This will return the string with your result, and then you can parse out the information you don't want...

If this is a feature you feel strongly about, you can leave a product suggestion for this here

Misha
0 Kudos
Message 5 of 6
(2,680 Views)

good To Download Mobdro Apk file on your Android device Mobdro watch the video later on anytime on your spare time. best.

0 Kudos
Message 6 of 6
(2,297 Views)