Hi I am a newbie to CF development in C#. My goal is to insert data via web service call; Upon successful insertion, my client will get an XML status ok. I am using HttpWebRequest and HttpWebResponse - and StreamWriter/StreamReader to write/read data into stream.
The code and error message are posted below -- any idea how to fix this?
// Get response
try
{
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
Notify_SPOC(response.ToString());
// Get the response stream
StreamReader reader = new StreamReader(response.GetResponseStream());
XmlTextReader txtReader = null;
txtReader = new XmlTextReader(reader);
Notify_SPOC(reader.ReadToEnd());
Notify_SPOC(response.StatusCode.ToString());
Notify_SPOC(response.StatusDescription.ToString());
while (true)
{
if (txtReader.NodeType == XmlNodeType.Element && txtReader.Name == "status")
{
string status = txtReader.ReadElementContentAsString();
isSuccessful = status.Equals("completed");
}
else
{
if (!txtReader.ReadToFollowing("status")) break;
}
}
txtReader.Close();
reader.Close();
}
}
catch (WebException wError)
{
//Notify SPOC of web exception error
string error_msg = "ERROR GetResponse-" + sender_phone + "; Message: " + wError.Message.ToString() + wError.StackTrace.ToString();
Notify_SPOC(error_msg);
//Write to a log file
using (StreamWriter logWriter = File.AppendText(LOG_FILE))
{
Log(wError.ToString(), logWriter);
// Close the writer and underlying file.
logWriter.Close();
}
}
ERROR GetResponse-+1905333333; Message: An error message cannot be displayed because an optional resource assembly containing it cannot be found at System.Net.HttpWebRequest.finishGetResponse() at System.Net.HttpWebRequest.GetResponse() at MyApplicationName.Form1.Message_Insertion() at MyApplicationName.Form1.SmsInterceptor_MessageReceived() at Microsoft.WindowsMobile.PocketOutlook.MessageInterception.MessagingMessageWindow.WndProc() at Microsoft.WindowsCE.Forms.MessageWindow._WndProc() at Microsoft.AGL.Forms.EVL.EnterMainLoop() at System.Windows.Forms.Application.Run() at MyApplicationName.Program.Main()