Click to See Complete Forum and Search --> : Error in the Web Service


ashutosh@24ondemand.com
December 19th, 2006, 03:34 AM
Hi All,

I have a problem in my web service application. I have created the web service in visual studio 2005 in which a method ReceiveMsg(string strMessage) accept the string(in Xml format) from the client and created the xml file. The web service is hosted on the IP(.203) , when I access this service from another IP(.73) it working fine and return “SUCCESS”. But when the client accesses this service they receive the “Fail” message. I have created the log file for this method. When client access this method a message “string instance not set to an instance of the string” is inserted into the log file.
Following is the code of the ReceiveMsg(string strMessage) method.

[WebMethod]
public string ReceiveMsg(string strMessage)
{
string strFinalResponse = null;
try
{
strFinalResponse = "SUCCESS";
intNo++; // this is static variable.
string strdocPath;
strdocPath = "C:\\RQFEED\\RQ"+intNo+".XML";
Byte[] docbinaryarray = Encoding.GetEncoding(1253).GetBytes(strMessage);
FileStream objfilestream = new FileStream(strdocPath, FileMode.Create, FileAccess.ReadWrite);
objfilestream.Write(docbinaryarray, 0, docbinaryarray.Length);
objfilestream.Close();

CreateLogFiles Err = new CreateLogFiles();
Err.ErrorLog(Server.MapPath("Logs/ErrorLog"), strMessage);
return strFinalResponse;
}
catch (Exception ex)
{
strFinalResponse = "FAIL";
CreateLogFiles Err = new CreateLogFiles();
Err.ErrorLog(Server.MapPath("Logs/ErrorLog"), ex.Message);
return strFinalResponse;

}
}

Please help me as asap.

Thanks with Regards

Ashutosh Kumar