简体   繁体   中英

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 problem. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM