LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Output array as XML using web services

Solved!
Go to solution

I am using Labview 8.6 web services to try and output a list of power supplies in a database as XML. When I wire the array to the terminal and set the URL mappings web services won't build because it says it's an unsupported data type. Any help would be appreciated.

Message Edited by Pawel Kowalski on 08-18-2009 10:39 AM
0 Kudos
Message 1 of 5
(4,105 Views)
I'm going to post a shameless bump. In textual programming this would be extremely easy as you have access to the output; there's gotta be a way to do this in LabVIEW, no?
0 Kudos
Message 2 of 5
(4,084 Views)
Solution
Accepted by topic author Pawel_Kowalski

An XML web service in LabVIEW 8.6 supports several data types. An array is not one of those.

 

The easiest way to get around this limitation would be to use a string indicator instead of the array indicator. Use the Flatten To XML primitive to convert your array into an XML string.

 

Alternatively, you could set your web service method to use Stream mode instead of Terminal mode. You can then use the Write Response VI in the web services palette to control what to write to the client and when. This seems to be what you meant when you wrote "access to the output".

 

Incidentally- Arrays can be used as outputs in Terminal mode in LabVIEW 2009.

 

Nathan

Message 3 of 5
(4,075 Views)

Thank you for the information Nathan. Both solutions you mentioned would work for me but I might go the LabView 2009 route as it was able to return this array as JSON data:

 

{"ps_list_array":[["1","Test PS 1","TCPIP::10.1.1.8::INSTR","This is a test power supply."],["2","Test PS 2","TCPIP::10.1.1.8::INSTR","This is a test power supply 2."],["3","Test PS 2","TCPIP::10.1.1.8::INSTR","This is a test power supply 2."]]}

 

This is perfect!

0 Kudos
Message 4 of 5
(4,065 Views)

Is there any way so that one can send data (array 'DBL' & about 60,000 elements) after converting it to a string using 'Flatten to String' function and not using 'Flatten to XML'?

 

Reason behind using 'Flatten to string' is the size of flattened data is much lesser that it would be in later case.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 5 of 5
(3,430 Views)