views:

671

answers:

2

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")&gt; _
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.

A: 

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.

John Saunders
Thanks -- Already tried it with a .NET client and it works fine. I should also note that I have other service operations that are working fine from Flex. It's only when enums are introduced that this error occurs.
Keith
A: 

I could not find a way to get this to work. Instead I replaced enums with string constants. Not as elegant, but it works.

Keith