How to handle sharepoint web services exceptions
I have developed an application of share point. I am using web services for that.
the problem is that while working with my app sometimes i get some exceptions. like,
Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.
Stack Strace :: at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at ......... my methods
From this exception i cannot understand the main pro开发者_StackOverflow社区blem. While developing i can debug the code, but now my application is getting launched..i can get error log file from my client which contains this type of excetions.
But how to catch exact error.???
Thanks.
One way is to set customErrors to On in your web.config file.
There is a good discussion in the comments of this article - SoapException sucks - about different ways to get the detail of exception thrown within SOAP methods.
Have you analyzed what the innerException contains ?
try
{
// do your web server thingies here
}
catch (SoapServerException ssx)
{
if (ssx.InnerException != null)
{
string message = ssx.InnerException.Message;
}
}
Regards,
Magnus
精彩评论