Using the Datacontract serializer with RestSharp and WCF Rest

For reasons that I am yet to understand, RestSharp’s Xml Serializer was not playing nice today with my WCF Rest service. I was trying send a simple Post request but couldn’t because the endpoint kept complaining that the namespace did not get added to the xml. Once I added it, for some obscure reasons, the message received on the server was always missing the collection I was sending as part of the package.

I suspect this has something to do with Big Mike’s implementation of Rest in WCF…but I still had to get my stuff working.

Instead of spending too much time trying to figure out what was wrong with it, especially since it affected a portion of the code meant for internal use only, I chose to go the “less clean” route using the DataContractSerializer

Here is the result

This will do for now 😛

Advertisements
Using the Datacontract serializer with RestSharp and WCF Rest

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s