Error: SendFailure (Error writing headers)

raBinnraBinn USMember ✭✭

Hi,

I am trying to read some data from a https server using HttpClient. The code works OK for HTTP but for https throw a exception: "System.Net.WebException: Error: SendFailure (Error writing headers)"

i search info about this exception but i find no solution.

Somebody could help me?,

Thank you very much.

`
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(serviceUrl);

request.UserAgent = "XML-RPC Client (Xamarin)";
request.Method = "POST";
request.ContentType = "text/xml";
request.Timeout = 6000;

XmlTextReader xmlResponse = new XmlTextReader(request.GetResponse().GetResponseStream());
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlResponse);

...
`

Tagged:

Answers

  • raBinnraBinn USMember ✭✭

    By another person having the same problem:

    Maybe my solution is not the best , but it works with https.

    INFO -> Connect with the service xml-rpc odoo from xamarin (c#)

    Process proceso = null;
    try {
        var info_proceso  = new ProcessStartInfo    {
        FileName = "curl",     
        Arguments = string.Format("-k {0} --data \"{1}\"", 
              bbdd.connection.url + "common",
              "<methodCall><methodName>login</methodName>" +
              "<param><value>your_bbdd</value></param>" + 
              "<param><value>your_user_or_mail</value></param>" + 
              "<param><value>your_pass</value></param></methodCall>"),
         RedirectStandardOutput = true,
         UseShellExecute = false,
         CreateNoWindow = false,
        };
    
        proceso = Process.Start(info_proceso);
        var res = proceso.StandardOutput.ReadToEnd();
        }
        finally {
            if (proceso != null && proceso.HasExited == false)
            proceso.Kill();
        }
    

    [thanks , you made me much stronger]

Sign In or Register to comment.