How can the error 'Client found response content type of 'text/html'.. be interpreted

后端 未结 9 1519
深忆病人
深忆病人 2020-12-18 17:54

I\'m using C# and connecting to a WebService via an auto-generated C# proxy object. The method I\'m calling can be long running, and sometimes times out. I get different err

9条回答
  •  再見小時候
    2020-12-18 18:36

    The problem I had was related to SOAP version. The asmx service was configured to accept both versions, 1.1 and 1.2, so, I think that when you are consuming the service, the client or the server doesn't know what version resolve.

    To fix that, is necessary add:

    using (wsWebService yourService = new wsWebService())
    {
        yourService.Url = "https://myUrlService.com/wsWebService.asmx?op=someOption";
        yourService.UseDefaultCredentials = true; // this line depends on your authentication type
        yourService.SoapVersion = SoapProtocolVersion.Soap11; // asign the version of SOAP
        var result = yourService.SomeMethod("Parameter");
    }
    

    Where wsWebService is the name of the class generated as a reference.

提交回复
热议问题