I have a webservice that runs fine throught he following url:


I created a console client that calls the webserviceusing HttpWebRequest as I want to save the XML returned, but I get this error:The remote server returned an error: (500) Internal Server Error.

Please check my code and guide on what needs to be fixed. Thank you.

namespace ResultsWebServicesWebClient
    public partial class _Default : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)

        private static void ProcessGetHttpRequest()

            Uri myUri = new Uri("http://localhost/ResultsWebServices/FG_Results.asmx/SendRequest?CaseNum=FG10-006294");

            HttpWebRequest HttpWReq = (HttpWebRequest)WebRequest.Create(myUri);
            HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse();
            if (HttpWResp.StatusCode == HttpStatusCode.OK)
                Console.WriteLine("\nRequest succeeded and the requested information is in the response  ,Description : {0}", HttpWResp.StatusDescription);
            if (myUri.Equals(HttpWResp.ResponseUri))
                Console.WriteLine("\nThe Request Uri was not redirected by the server");
                Console.WriteLine("\nThe Request Uri was redirected to :{0}", HttpWResp.ResponseUri);
            Console.WriteLine("Content length is {0}", HttpWResp.ContentLength);
            Console.WriteLine("Content type is {0}", HttpWResp.ContentType);
            Console.WriteLine("Protocol Version is {0}", HttpWResp.ProtocolVersion.ToString());

            // Get the stream associated with the response.

            Stream receiveStream = HttpWResp.GetResponseStream();
            // Pipes the stream to a higher level stream reader with the required encoding format.

            StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
            //code there