Last post Aug 14, 2012 02:29 PM by mitja.GTI
Aug 09, 2012 04:01 PM|Shawn2012|LINK
I'm trying to build a client to call a web service by sending a serialized object as the content in the request. I was going to use ObjectContent but I don't think that is available in the RC. I read this on
"To send a request that contains an ObjectContent use the PostAsync<T> extension methods on HttpClient. Or, use the PostAsJsonAsync<T> and PostAsXmlAsync<T> extension methods to specify a request that will be specifically formatted with as JSON or XML
Is this correct that you can call the PostAsync method on HttpClient using an argument type? I'm running 4.5 RC on VS 2012 RC and that's now working. Could anyone provide an example that demonstrates what the white papers recommends or an alternative
was in the 4.5 RC to send a class object as the content in an http post?
Aug 14, 2012 02:29 PM|mitja.GTI|LINK
You don't have to worry about serialization as such if you are calling your service from code behind (unless you want to define your own or use a specific one). Simply add a service reference to your project. It will create the client for you. There are
numerous articles about creating a simple WCF service and client on the internet.
and JSON. Serialization must be done "by hand" and it must match the sample on help page. Browse my old posts, I have recently posted a sample WCF REST service and how to call it from client side.