Apache – Flex & WCF – Enum error

apache-flexenumswcf

I have a WCF service operation that accepts a data contract parameter of custom type MyQuery — function Search(q as MyQuery). The MyQuery object contains 2 properties:

MyQuery.SearchPhrase (string)  
MyQuery.SearchType (custom enum SearchTypeEnum)

I also have a Flex client application that consumes this service. But when Flex invokes the Search() operation, I get the following error about the enumeration property:

"Cannot find definition for type
'http://mydomain/2009/04/SearchTypeEnum::SearchTypeEnum"

The error is thrown from Flex while it is building the request to the service.

So my question is….. is there any way to work around this issue in Flex? Or is my only alternative to redesign the service without enums?

This is how the enum data contract is defined at the service tier:

<DataContract(Namespace:="http://mydomain/2009/04/SearchTypeEnum")> _
Public Enum SearchTypeEnum
    <EnumMember()> [Boolean] = 0
    <EnumMember()> [NaturalLanguage] = 1
End Enum

As far as I know this is the correct definition of an enum data contract. I also tried using the ServiceKnownType and KnownType attributes on the service and on the MyQuery class but to no avail.

Best Answer

I would recommend you try that with a trivial .NET client - maybe even a console application. The idea would be to see if you can get any application to work with the service.