HTTP request is unauthorized

Can someone please help me get started using the FlightXML2 API.

I have read all of the examples and followed the instructions. I’m using Visual Studio 2017, C#. I created a new project. I created a service reference called FlightXML2

FlightXML2.FlightXML2SoapClient client = new FlightXML2.FlightXML2SoapClient();
client.ClientCredentials.UserName.UserName = “???”;
client.ClientCredentials.UserName.Password = “???”;
int ret = client.RegisterAlertEndpoint(???", “json/post”);

I’m using my user ID and API key, and when I execute the first command RegisterAlertEndpoint I get the error.

System.ServiceModel.Security.MessageSecurityException: ‘The HTTP request is unauthorized with client authentication scheme ‘Anonymous’. The authentication header received from the server was ‘Basic realm=“FlightXML2”’.’

I have also tried to generate a class using wsdl.exe /out:c:\fa\FlightXML2.cs http://flightxml.flightaware.com/soap/FlightXML2/wsdl, and include the class in my project but it does not work.

Please let me know what to do.

Thanks for you assistance.
Jeff

Be sure you’re supplying the API key as the password, and not your website password. Try starting out with a simpler FlightXML function, such as one made by our stock example code, rather than something as complex as RegisterAlertEndpoint.