Hi,
I'm trying to consume a CRM Organization SOAP service form a C# console application, but whenever I call the following code I get an exception regarding destabilization.
Here is my code:
string strURI = @"serveraddress/.../Organization.svc";
CRMService.OrganizationServiceClient orgProxy = new OrganizationServiceClient();
orgProxy.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("username", "password", "domain");
System.ServiceModel.EndpointAddress myEndpointAdd = new System.ServiceModel.EndpointAddress(new Uri(strURI), System.ServiceModel.EndpointIdentity.CreateDnsIdentity(""));
ColumnSet columns=new ColumnSet();
columns.Columns=new string[]{"name","parentaccountid"};
orgProxy.Endpoint.Address = myEndpointAdd;
var test = orgProxy.Retrieve("account", new Guid("25691CAF-DEDF-E511-80C2-005056895026"), columns);
Exception:
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 schemas.microsoft.com/.../Services:RetrieveResult. The InnerException message was 'Error in line 1 position 783. Element 'schemas.datacontract.org/.../System.Collections.Generic:value' contains data from a type that maps to the name 'schemas.microsoft.com/.../Contracts:EntityReference'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver if you are using DataContractSerializer or add the type corresponding to 'EntityReference' 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 the serializer.'. Please see InnerException for more details.
*This post is locked for comments
I have the same question (0)