.net 서비스 모델을 사용하여 C# 웹 서비스를 호출하고 때로는이 웹 서비스가 Microsoft.SharePoint.SoapServer.SoapServerException을 throw합니다. FaultException을 사용하여 웹 서비스에서 반환 된 친숙한 오류 메시지를 얻을 수는 없지만 클라이언트 코드에서이 예외를 catch 할 수는 있습니다.WebServices에서 FaultException 캐치
다음은 예외가있을 때 웹 서비스에 대한 네트워크 추적입니다.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring>
<detail>
<errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">Access to this Web site has been blocked.
Please contact the administrator to resolve this problem.</errorstring>
<errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x81020071</errorcode>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
위의 응답에서 오류 문자열 노드간에 콘텐츠를 가져 오는 데 매우 관심이 있습니다. 그러나 FaultException 클래스에서 위의 오류 메시지를 검색 할 수 없습니다. .NET 프레임 워크가 위의 응답을 올바르게 deserialize하지 않거나 잘못된 excepetion 클래스를 사용하고 있습니다.
FaultException에서 얻을 수있는 유일한 오류 메시지는 "Microsoft.SharePoint.SoapServer.SoapServerException '형식의 예외가 throw되었습니다"라는 것입니다.
웹 서비스를 제어 할 권한이 없습니다.
감사합니다. 코드에서 방금 내 문제를 해결하는 방법을 알려주었습니다 (몇 시간 후에). 리플렉션을 통해 wcf proxy 클래스의 메소드를 호출하는 경우, clr이 내부 예외로 예외 예외를 발생시키는 것을 알아야합니다. –