Issue with http request

299 Views Asked by At

I have an issue when I'm using webservice and when I try to access to some method I got this error:

An exception of type 'System.ServiceModel.CommunicationException' occurred in mscorlib.dll but was not handled in user code

Additional information: An error occurred while making the HTTP request to https://flightxml.flightaware.com/soap/FlightXML2/op. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.

I call the web method like this

FlightXML2SoapClient client = new FlightXML2SoapClient();
        
client.ClientCredentials.UserName.UserName = username;
client.ClientCredentials.UserName.Password = password;
        
string[] pm = client.AllAirports();
        
   

I've tried also with securityprotol(ssl3,tls11,tls12) but still nothing. I even tried with different versions of framework (5.0,6.0 and 7.0) and I got the same error.

My webconfig looks like this

  </system.codedom>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="FlightXML2Soap">
          <security mode="Transport">
            <transport clientCredentialType="Basic"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://flightxml.flightaware.com/soap/FlightXML2/op" binding="basicHttpBinding" bindingConfiguration="FlightXML2Soap" contract="FlightAwareXML.FlightXML2Soap" name="FlightXML2Soap"/>
    </client>
  </system.serviceModel>
0

There are 0 best solutions below