WCF - client deserialization
Hi there
I understand that with WCF you decorate a Service Contract and expose members with OperationContract.
Question is:
if you create an operation contract for a method like:
public SomeClass MyMethod()
I understand that you decorate the SomeClass with DataContract attributes.
Question - how does the client know about SomeClass? Does SomeClass need to be defined in the client code as well?
Danatas GerviPosted Nov 8, 2009, 2:51 AM
The answer – Yes.
:)
The client must have assembly with all operation contract methods defined.
There is two ways:
1 You can implement all service methods and classes in separated assembly (something like "common clases.dll") and both – the client and server will use it.
2 You can run you ready to work service on any place, and use "Add service reference " wizard in Visual Studio. For using this way you must have the MEX (metadata exchange) endpoint and binding set up correctly.
2a – you can get Operation contract methods and Data contract classes from compiled service assembly (also from "add service reference" wizard.