Wednesday, August 29, 2012

WCF: Why isn't my object showing up on the client side?

I had a minor head-palm moment a few minutes ago.

Problem
I declared an object in my WCF service with the correct DataContract and DataMember attributes, but my
service reference still didn't acknowledge the object, even after I did an update/refresh on the reference.

Solution
Then it hit me. I didn't use the object in the service itself. Meaning there is no mention or use of said object in the actual Service or Service Contract.

Conclusion
So the answer to "Why isn't my object showing up on the client side?" is: In order to be able to use a WCF provided object, it must be used in the Service/Service Contract (Interface). This is pretty basic, but sometimes you just forget. Less of an obscure problem and more of a gotcha.

No comments:

Post a Comment