[英]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. 我正在尝试创建一个示例REST服务和一个客户端。 I'm quite shocked, because it seems that I can only ready the messagebody over a hack, the operationContext:
我很震惊,因为似乎我只能通过hack操作上下文来准备消息正文:
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? 因此,我可以通过URI发送原始类型,并且必须遍历上下文以读取xml数据? Since it seems I can just select xml or json as body, I have to work with one of these.
由于似乎我只能选择xml或json作为正文,因此我必须使用其中之一。 So all I can pass directly are primitive types over the URI?
因此,我可以直接传递的只是URI上的原始类型?
Which leads me to the question: Is it not the idea of REST to pass complex types but primitives over the URI? 这就引出了一个问题:不是通过REST传递复杂类型而是通过URI传递原语的想法? Or is there a easier solution I didn't find yet?
还是有一个我找不到的更简单的解决方案?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.