开发者

Accepting XML as method parameters in WCF RESTful Service

Folks, I'm about 90% of where I want to be with my WCF RESTful service but I'm having a little trouble with figuring out a good way to do POST data. I want it to work the way it does in the MVC engine where the body of the HTTP message in the POST is run through the model binder and it tries to convert that data into the data type of the first method parameter.

So, in other words, I have a method in my contract:

[OperationContract]
[WebInvoke(Method="POST", RequestFormat=WebMessageFormat.Xml, ResponseFormat=WebMessageFormat.Xml)]
SubmitInvoiceResponse SubmitInvoice();

If I change the above signature to:

SubmitInvoiceResponse SubmitInvoice(Invoice invoice);

Will this automatically look for an invoice as serialized XML in the message body? If not, what are the attributes and/or swi开发者_如何学Ctches I need to configure in order for this to be the way WCF behaves?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜