How to narrow down to the actual issue when you receive a generic SoapException: Server was unable to process request. from MS-CRM 4.0

淺唱寂寞╮ 提交于 2019-12-22 13:52:29

问题


I recently started programming against CRM 4.0 and I am issuing these requests using the CrmService. Often I get the wrong values in the some property of the dynamic entity that I am using when I send the request. Of course the request fails, am intercepting the exception and log it. The problem is that this is what I get:

System.Web.Services.Protocols.SoapException: Server was unable to process request.
   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 Microsoft.Crm.SdkTypeProxy.CrmService.Execute(Request Request)
   at MyEntity.Employee.ExecuteCreateRequest(CrmService service, DynamicEntity entity) in c:\Workspaces\One\...\Employee.vb:line 351\nSystem.Xml.XmlElement

which is not much to go with.

Until now I was eliminating some properties by hunch and test it again and then tried to guess what might be wrong with the property's value. Is there another way to get some more detailed information of what cause the error so I can pinpoint the actual culprit faster.


回答1:


You'll need your catch block to catch SoapException and then you can surface the Detail, or Message properties as required. The Details property likely contains the hints you are looking for...

...
catch(SoapExcetion soapEx){
    console.writeLine("SoapException: " + soapEx.Detail);
//    console.writeLine("SoapException: " + soapEx.Message);
}
catch(Exception ex){
    console.writeLine("Exception: " + ex.Detail);
}

You might also consider enabling Tracing on the CRM server and looking at the log files too.



来源:https://stackoverflow.com/questions/10340591/how-to-narrow-down-to-the-actual-issue-when-you-receive-a-generic-soapexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!