So, basically I am creating a Windows Service that is going to consult a SOAP Service and after that return an item. To find that item, who made the service created 2 "filters". customerFilter and itemFilter. So, when I create the web request I need to insert thoose 2 parameters.
I have this:
static string date = DateTime.Now.Date.ToString("yyyy_MM_dd");
        static string pathLog = "Logs/LogGetSalesLineDiscount/" + date + "LogGetSalesLineDiscount.txt";
        public static string[] CallWebService(IOrganizationService service)
        {
            var action = "http://...";
            var url = "http://...";
            var request = (HttpWebRequest)WebRequest.Create(url);
            var postData = "customerFilter=" + Uri.EscapeDataString("TESTE");
            postData += "&itemFilter=" + Uri.EscapeDataString("TESTE");
            var data = Encoding.ASCII.GetBytes(postData);
            request.Method = "POST";
            request.ContentType = "text/xml;charset=\"utf-8\"";
            request.Headers.Add("SOAPAction", action);
            request.ContentLength = data.Length;
            request.Accept = "text/xml";
            request.Credentials = new NetworkCredential("...", "...");
            using (var stream = request.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
            }
            var response = (HttpWebResponse)request.GetResponse();
            var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(AppDomain.CurrentDomain.BaseDirectory + pathLog, true))
            {
               file.WriteLine(responseString);
            }
            
            return null;
        }
    }
If I have that, it will return an error 500. I don´t know why.
If I remove the action, it will return something about all the actions in the service...
Please help me, I dont know what to do....