简体   繁体   中英

REST Services - Do I really have to read the OperationContext to get the message?

I'm trying to create a sample REST-service and a client. I'm quite shocked, because it seems that I can only ready the messagebody over a hack, the operationContext:

var ctx = OperationContext.Current.RequestContext.RequestMessage;

So I can just send primitive types over the URI and have to go over the context to read the xml data? Since it seems I can just select xml or json as body, I have to work with one of these. So all I can pass directly are primitive types over the URI?

Which leads me to the question: Is it not the idea of REST to pass complex types but primitives over the URI? Or is there a easier solution I didn't find yet?

In order to make restful services you should consider using WCF Restful services. They are easy and Robust. You can see a tutorial here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM