Reputation: 1708
I'm working on a server application, which will use web services to communicate with the user clients. I need to make the services accessible on every platform (basically all kinds of mobile phones), so by default using WCF would be painful on the client side, but i was wondering, if there was a not-too-hard way to customize WCF messages, so that i can give an exact, and easy-to-use specification to the client-guys.
Upvotes: 1
Views: 54
Reputation: 754200
You can pick between DataContractSerializer
(the default) or XmlSerializer
using an attribute on your service contract. There's also the NetDataContractSerializer
but you cannot use this with an attribute.
Use DataContractSerializer
:
[DataContractSerializerFormat]
[ServiceContract]
public interface IYourService
{
......
}
Use XmlSerializer
:
[XmlSerializerFormat]
[ServiceContract]
public interface IYourService
{
......
}
If you really must, you can define your own serializer to handle serialization totally the way you want (watch out for the amount of work needed for this!).
See Service Station: Serialization in WCF for more info on the serializers
Upvotes: 2