From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timeout when consuming a SOAP web service

Hello,

 

I'm quite new to Labview and I'm trying to consume a SOAP web service created using a very simple WCF example, but I keep on getting a WebException because of a timeout.

 

The web service has been created using the example from the WCF getting started tutotial (to keep things simple) http://msdn.microsoft.com/en-us/library/ms734712.aspx

You'll find my .Net solution attached to this message. (You'll have to be administrator to run the service though).

 

I have used the import web service tool in Labview to create the VI to connect to the web service and all went fine, it created the VI correctly. You'll find the created VI also attached to this message.

 

Then, I'm trying to create a very simple VI to call the webservice and put the return value inside a numeric indicator. Unfortunately, when I run this VI it crashes with a WebException because of a timeout.

 

Test VI.png

 

If I run the .Net client, everything goes fine, and if I go to the web service address with a browser, I get the service website, so I know that the server is registered correctly, only Labview can't connect to it for an unknown reason. Everything is setup to connect through localhost:8000, so it can't really be a network problem, I've tried disabling the Windows firewall to see if that was the problem, but it persists.

 

I've also tried to do something similar using the CDYNE web service, like in the example http://www.ni.com/white-paper/4728/en/, and it works perfectly.

 

Does anybody have an idea about what could be the issue?

 

Regards.

Download All
0 Kudos
Message 1 of 2
(2,814 Views)

OK, I found the problem myself, it was a problem with the configuration of the WCF service, I was missing the ServiceMetadata endpoint.

 

For reference, if somebody stumbles upon the same issue as I had, here's a service configuration that works with Labview (using .Net >=4.0)

 

  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add scheme="http" binding="basicHttpBinding" />
    </protocolMapping>
  </system.serviceModel>

And here's how to create and run the service host.

using (ServiceHost selfHost = new ServiceHost(typeof(Calculator), new Uri("http://localhost:8000/Calculator")))
            {
                try
                {

                    selfHost.Open();

                    Console.ReadLine();
 
                    selfHost.Close();
 
                }
                catch (CommunicationException e)
                {

                    selfHost.Abort();
                    throw;
                }
            }
0 Kudos
Message 2 of 2
(2,796 Views)