I recently had a lot of trouble getting some data exposed to the BDC. I found the documentation pretty light and leading to a pretty frustrating experience.
In my case there are three scenarios:
Return All Records, No Finder – This one is pretty easy and it is clear that you need to return a collection of records.
Return One Record, Specific Finder – This one is pretty simple as well and it is clear that you will get back a single record.
Return One Record, Finder – This one was the cause of all my trouble. It seemed to me that if you are only expecting a single record then it could be defined as such. Using BDC MetaMan I was able to generate a definition for all three types, and then able to import the definition into the BDC.
Whenever I tried to use show the data BDC List web part I kept seeing an error. In the ULS logs I found the following:
System.InvalidOperationException: Backend system adapter returned a structure incompatible with the corresponding metadata (MethodInstance, Parameter or TypeDescriptor)
I of course concentrated on checking data types and matched up the web service to the definition file to make sure things were in line. They matched perfectly, so this proved to be quite the hurdle. Finally on MSDN I caught a reference to the error “a structure incompatible with the corresponding metadata” and making sure the Collection was specified correctly. Even this reference did not specify that a collection was required. We made a quick change to the web service’s returned data type and everything started working.
So the moral of the story is… when using the BDC with anything but a Specific Finder it requires a Collection/Array to be returned.