10-07-2011 04:07 AM - edited 10-07-2011 04:16 AM
Hi everybody!
I'm trying to use LabVIEW 2010 to access to a remote WCF web service made up in C# with Visual Studio 2010 using the .NET Framework 4.0.
I tried to use the tool which can be found going in the LV Getting Started window and selecting: Tools -> Import -> Web service... I then copied the URL of the web sevice when asked. The result was an error message saying:
Validation failed.
Possible reasons are:
1. The URL does not exists or the WSDL is bad.
2. Authentication is not correct.
3. Proxy information is not correct.
Searching the net (see links below), i discovered that the import of WCF web services is not possible in LV. So, to access to a WCF web service, a workaround is needed.
http://forums.ni.com/t5/LabVIEW/WCF-web-services-with-LabVIEW/m-p/1605832/highlight/true#M583079
http://forums.ni.com/t5/LabVIEW/create-NET-assembly/m-p/876239/highlight/true#M396545
The point is that i'm a little bit confused about the method to use to realize this workaround. The problem is that i'm not really familiar with Microsoft tools so i think i need some example and/or a list of steps to do to achieve the goal!
Any suggerstions will be appreciated.
aRCo
10-13-2011
12:02 PM
- last edited on
11-06-2024
04:59 PM
by
Content Cleaner
Hello Arco!
WCF is not directly supported as a web service using the import tool.
You have two other options though. The first option is to communicate with the web service using HTTP client VIs.
For this you must know the specifics of WCF syntax and be willing to parse XML responses. This will allow you to stay within the LabVIEW environment, but you must know the web service methods.
The second option is to utilize the Service Model Metadata Utility Tool (SvcUtil.exe) from Visual Studio.
http://msdn.microsoft.com/en-us/library/ms733133%28v=VS.90%29.aspx
This tool generates client code as well as a configuration file. These files can then be built into an assembly which can then be called with LabVIEW. For this option, you must utilize Visual Studio in addition to LabVIEW, though you will not need to know the web service methods.
Although these methods differ than Web Service Import Tool, they will allow you to interact using the LabVIEW environment.
Kind regards,
12-20-2011 01:00 PM
I've tried the second option above, that is, use svcutil to build client code and a config file, then use Visual Studio 2010 to build an assembly. When I then call that assembly with LabVIEW, I get the error dialog in the attached .jpg. Any idea what's going on?
05-03-2012 07:39 PM - edited 05-03-2012 07:39 PM
I'm trying this approach and I got it kind of working witha few tweaks, however the people who are going to be supporting this code don't know .NET at all so I'm trying to make changes to the LabVIEW generated classes/VIs to see if it works. If and when we make changes to the Web Service the users will have to update the webservice with the LabVIEW importer and the VisualStudio solution will no longer work.
This is probably an R&D question but does anybody know what classes the LabVIEW autogenerated WebService class inherits from? In order to make things work I need to be able to set the HttpWebRequest .NET object KeepAlive flag to false. The equivalent in WCF lingo is creating a binding with the KeepAlive flag set to false (as mentioned in here). In other words I need the Keep-Alive field out of the HTTP header...
Thanks for your help!