EWS and WCF 3.5
-
Tuesday, January 22, 2008 4:23 PM
Hello,
we are trying to use WCF/.Net 3.5 to call the Excel Web Services. Most calls work correctly (open workbook, set cell, get api version, etc.), but some don't. For example, when we call GetRangeA1, we get a NetDispatcherFaultException, with the following detail:
{"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 of the 'http://schemas.microsoft.com/office/excel/server/webservices:ArrayOfAnyType' data contract. The deserializer has no knowledge of any type that maps to this contract. 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."}
Most suggestions to situations where this happens envolve changing the original source contract, which is not an option since this is a part of SharePoint (maybe we could change the WSDL?). Any help would be greatly appreciated.
Can we, after all, use .Net 3.5 to interact with EWS??
Thanks in advance
Answers
-
Tuesday, January 22, 2008 5:06 PM
We just found the solution, with a little help from a friend: instead of using "Add Service Reference" in VS2008, we have to use svcutil to generate the client proxy, using parameter /serializer:XmlSerializer . This used the XmlSerializer instead of the DataContractSerializer.
Thanks anyway.

