Trying to use the AirlineFlightSchedules C# API


#1

Hi,

should the following work? (Visual Studio 2013, yes I do have an API key).

ArrayOfAirlineFlightScheduleStruct results = df.AirlineFlightSchedules(1414800000, 1414886400, “”, “”, “WS”, “”, 15, 0);
foreach(var r in results.data)
{
System.Console.WriteLine(r.actual_ident + " " + r.aircrafttype + " " + r.departuretime + " " + r.origin + " " + r.arrivaltime + " " + r.destination);
}

I am getting errors that ArrayOfAirlineFlightScheduleStruct does not implement Add() but it must because it derives from IEnumerable.
Removing the IEnumerable does result in the service being not available.

I am trying to replicate
flightxml.flightaware.com/json/F … &howMany=3
(which works fine) in C#.

Thanks,
Oliver


#2

Here is some more information:

I am having the following problem trying to use the AirlineFlightSchedules C# API.

complete file (other than the credentials):

using System.Net;

class test
{
public static void Main(string] args)
{
FlightXML2 df = new FlightXML2();
df.Credentials = new NetworkCredential(“lala”, “lala”);
df.PreAuthenticate = true;

    ArrayOfAirlineFlightScheduleStruct results = df.AirlineFlightSchedules(1414800000, 1414886400, "", "", "WS", "", 15, 0);
    //foreach(var r in results.data)
    //{
    //    System.Console.WriteLine(r.actual_ident + " " + r.aircrafttype + " " + r.departuretime + " " + r.origin + " " + r.arrivaltime + " " + r.destination);
    //}


    // this works fine:
    // [flightxml.flightaware.com/json/F ... &howMany=3](http://flightxml.flightaware.com/json/FlightXML2/AirlineFlightSchedules?startDate=1414800000&endDate=1414886400&offset=0&airline=WS&howMany=3)

    // examples below works fine:

    // // get the flights currently enroute.
    //EnrouteStruct r = df.Enroute("KAUS", 10, "", 0);
    //foreach (EnrouteFlightStruct e in r.enroute)
    //{
    //    System.Console.WriteLine(e.ident);
    //}

    // // get the weather.
    // System.Console.WriteLine(df.Metar("KAUS"));
}

}

The c# api enroute example from your website works fine (commented out in the project).

The AirlineFlightSchedules call times out with below:
{System.Net.WebException: The request failed with HTTP status 503: Service Unavailable.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object] parameters)
at FlightXML2.AirlineFlightSchedules(Int32 startDate, Int32 endDate, String origin, String destination, String airline, String flightno, Int32 howMany, Int32 offset) in c:\Users\oliver\Documents\Visual Studio 2013\Projects\FlightAware\FlightAware\FlightXML2.cs:line 355
at test.Main(String] args) in c:\Users\oliver\Documents\Visual Studio 2013\Projects\FlightAware\FlightAware\Program.cs:line 12}

Using the json link (commented out in the project) works fine also.
Steps:
I used
wsdl.exe flightxml.flightaware.com/soap/FlightXML2/wsdl
to create the FlightXml2.cs file.

Then just tried to compile and run above.

Please let me know if I can provide any more information. I very much appreciate your help.

Thanks,
Oliver