03-09-2010 05:03 AM
Hi all,
Ive imported a webservice into Labview 2009 using the Wizard provided. However when I try to display what I am bringing back I experience problems.
It seems to bring back 2 .Net methods aswell as a numeric indicator.
What I am trying to import is a datatable. Is there a particular problem with this particular format? What is the preferred layout?
Thanks in advance to any help I recieve. Ive been blitzing the web for this for the last couple of days.
Cheers,
Rik
03-09-2010 06:32 AM
The DataTable is not a known data type in LabVIEW. You need to extract the contents in order to operate or display the DataTable elements.
See this post for an example of extracting the elements.
How to convert .net datatable datatype to labview array of strings
03-09-2010 07:00 AM
Thanks alot, that kind of makes sense but Im still very new to Labview so it may well take a while to get my head around. Having just had a talk with my boss we going to reconstruct the webservice to output xml instead so that I can parse my way through it. Still annoying but a fair bit easier than that example!
Cheers,
Rik
03-09-2010 01:15 PM
Using XML data in LabVIEW is hard.
OK. I've just bummed you out. Why are you using LabVIEW in the first place, right?
LabVIEW is a dataflow language. That means that in order to write your program, you need some sort of definition for the data that will flow over the wires. The DataTable object and XML data do not represent a fixed data definition. These structures are normally manipulated by programming languages that rely heavily on pointers within the data.
The example I pointed you to is effectively extracting (copying) all of the data from the DataTable and placing it onto wires where it can be manipulated by LabVIEW. You need to know the structure of the data in the DataTable in order to extract it and create LabVIEW data.
The Import WebService wizard is pretty good; as long as you keep your data types simple. For example, if you import this WSDL definition:
http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl
you should have two 'get' type functions. Each one will return a cluster of data based on the zip code provided.
The cluster includes strings, a Boolean, and an array of references to a forcast object that contains a forcast for each day. Each forcast element includes a timestamp, string, and arrays of references to max/min temps and an integer value for the WeatherID.
What you want to do is export your data from your service in a way that you will create simple data types; strings, Booleans, integers or floats, and arrays of these types...
Try the example Weather service and get your feet wet before trying to modify your WebService...