2010-07-07 2 views
0

공유 지점 2010 서버에서 Excel 파일 데이터를 읽는 데 사용되는 간단한 Silverlight 4.0 응용 프로그램을 만듭니다. 나는 "Excel 웹 서비스"를 사용하려고하지만 GetRangeA1 방법 호출 할 때 내가 여기에 오류가 :메서드 호출시 ArrayOfAnyType 문제가 발생합니다. Silverlight에서 웹 서비스를 능가하는 GetRangeA1.0

An unhandled exception of type 'System.ServiceModel.Dispatcher.NetDispatcherFaultException' occurred in mscorlib.dll 

Additional information: The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://schemas.microsoft.com/office/excel/server/webservices:GetRangeA1Response. The InnerException message was 'Error in line 1 position 361. Element 'http://schemas.microsoft.com/office/excel/server/webservices:anyType' contains data from a type that maps to the name 'http://schemas.microsoft.com/office/excel/server/webservices:ArrayOfAnyType'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type corresponding to 'ArrayOfAnyType' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details. 

소스 코드와 같은 것입니다 :

namespace SampleApplication 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      ExcelServiceSoapClient xlservice = new ExcelServiceSoapClient(); 
      xlservice.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; 
      Status[] outStatus; 

      string targetWorkbookPath = "http://phc/Shared%20Documents/sample.xlsx"; 

      try 
      { 
       // Call open workbook, and point to the trusted location of the workbook to open. 
       string sessionId = xlservice.OpenWorkbook(targetWorkbookPath, "en-US", "en-US", out outStatus); 
       Console.WriteLine("sessionID : {0}", sessionId); 

       //1. works fines. 
       object res = xlservice.GetCellA1(sessionId, "CER by Feature", "B1", true, out outStatus); 

       //2. exception 
       xlservice.GetRangeA1(sessionId, "CER by Feature", "H19:H21", true, out outStatus); 

       // Close workbook. This also closes session. 
       xlservice.CloseWorkbook(sessionId); 
      } 
      catch (SoapException e) 
      { 
       Console.WriteLine("SOAP Exception Message: {0}", e.Message); 
      } 

     } 
    } 
} 

을 나는 실버에 완전히 새로운 오전 셰어 포인트 developping, 나는 주위를 검색하지만 행운을 얻지 못했고, 그냥 다른 게시물 here, 아무도 나를 도울 수 발견?

답변

0

이는 미결제 문제가 될 것으로 보인다,하지만 난 지금까지 발견 두 가지 해결 방법 :

1)의 App.config의 변화를 요구하는. 서비스 참조 추가를 사용하지 않고는 svcutil와 서비스 참조를 다시 표시

http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/ab2a08d5-2e91-4dc1-bd80-6fc29b5f14eb

2) :

http://social.msdn.microsoft.com/Forums/en-GB/sharepointexcel/thread/2fd36e6b-5fa7-47a4-9d79-b11493d18107

관련 문제