Error adding WCF service reference with type ObservableCollection

When I try to add a service reference to an existing WCF service (which provides collections of type ObservableCollection ), I get the following error message:

The schema type 'http://schemas.microsoft.com/2003/10/Serialization/Arrays:ArrayOfString' has not yet been imported. Import it first.

I tried changing the Framework (on the Add Web Link screen) to .NET 2.0 Web Services. In this case, I do not receive the above error message, however I cannot call several functions provided by the WCF service (they simply are not generated).

Can someone help me?

Thanks in advance.

Ernstjan

+4
source share
2 answers

Microsoft defines Arrays in the namespace "http://schemas.microsoft.com/2003//Serialization/Arrays" in which non-MS will have problems finding it, so define your "ArrayOfString" and serialize it:

 [CollectionDataContract(ItemName = "string", Namespace = "SAME NAMESPACE AS YOUR PROJECT!!!")] public class ArrayOfString : List<string> { } 

And then you should be fine.

0
source

This is a bug in the Mono WSDL Importer, which does not fully support collection types.

I just implemented this, so you will see it in Monotouch soon. As a workaround, you need to create a client proxy in Windows using Visual Studio or Svcutil.exe .

0
source

Source: https://habr.com/ru/post/1414773/


All Articles