Please Help: Having issues getting C# Example to work


#1

Hi, I followed the C# Example verbatim on Visual Studio 2015 - I added the service reference flightxml.flightaware.com/soap/FlightXML2/wsdl), copied the code over using my username and API Key, and got everything compiling. However, I am getting the following error when I execute the test method:

System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at flightxml.flightaware.com/soap/FlightXML2/wsdl that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
System.Net.WebException: Unable to connect to the remote serverSystem.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Anyone have any ideas?

Here is a cut and paste of my code:

app.config:

<system.serviceModel>












</system.serviceModel>

C# Code:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Atsg.Tests.FlightXML2;

namespace Atsg.Tests.Web
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
FlightXML2SoapClient client = new FlightXML2SoapClient();
client.ClientCredentials.UserName.UserName = “MyUserName”;
client.ClientCredentials.UserName.Password = “MyApiKey”;

        EnrouteStruct r = client.Enroute("KHOU", 10, "", 0);
        foreach (EnrouteFlightStruct e in r.enroute)
        {
            Console.WriteLine(e.ident);
        }

        Console.WriteLine(client.Metar("KAUS"));
    }
}

}


#2

I don’t see any issues with the code and app.config. It seems like perhaps there is an issue with the connection itself? If you’re able to browse the Connected Services and see the endpoints then the WSDL was successfully pulled down. The only difference between my app.config is that I’m not specifying useDefaultWebProxy. Perhaps though someone on the forums is more of a .NET person and may have an idea.

Have you tried just setting up a REST Client instead of using the SOAP interface? We have a dotnetcore example using a REST client for FlightXML3. github.com/flightaware/flightxm … dotnetcore

You could modify the URL to call FlightXML2 instead.


#3

Self-resolved (proxy issues). Please close. Thanks.