获取 WCF 服务以将 POST 参数映射到参数

发布于 2024-07-12 11:29:44 字数 608 浏览 2 评论 0原文

我有一个遗留服务,我希望更新到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光无声 2024-07-19 11:29:44

好的,这个示例让我到达了我需要去的大部分地方:
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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文