获取 WCF 服务以将 POST 参数映射到参数
我有一个遗留服务,我希望更新到 WCF,它的行为之一是允许客户端 POST 具有以下内容的请求:
MyService.asmx/ProcessDocument Post 数据如下所示:
request=<big block of xml>
现在在 ASMX 时代,该服务接受单个字符串参数,即:
public void ProcessDocument(string request) {
}
到目前为止,我仅按照本文中的建议使用 Stream 来使其在 WCF 中工作: http://www .dennydotnet.com/post/2008/09/16/WCF-REST-and-POST-Lets-Dance!.aspx
流可以工作,只是需要更多的步骤才能使其工作于看起来的东西应该开箱即用地支持它。
我对 WCF 还很陌生 - 我错过了什么?
I have a legacy service I'm looking to update to WCF and one of it's behaviours is to allow clients to POST a request that has something like:
MyService.asmx/ProcessDocument
With Post data looking like:
request=<big block of xml>
Now in the ASMX days this service accepted a single string parameter i.e:
public void ProcessDocument(string request) {
}
So far I have only gotten this to work in WCF by using a Stream as of the advice in this post here:
http://www.dennydotnet.com/post/2008/09/16/WCF-REST-and-POST-Lets-Dance!.aspx
A Stream will work, there are just more steps involved to make it work for something that seems to it should be supported out of the box.
I am pretty new to WCF - what am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,这个示例让我到达了我需要去的大部分地方:
http://msdn.microsoft.com/en-us/library/bb943485。 aspx
我现在让它按要求工作。
OK, this sample got me to most of where I needed to go:
http://msdn.microsoft.com/en-us/library/bb943485.aspx
I now have it working as required.