WCF 如何决定分派到哪个操作?

发布于 2024-10-22 01:09:59 字数 481 浏览 3 评论 0原文

我正在构建一个 WCF SOAP 应用程序。 WSDL 文件具有许多操作,其中许多操作具有相同的参数类型。 WSDL 文件将所有soapAction 属性定义为“''”。当我尝试启动这样的服务时,WCF 抛出一个异常,指出soapActions 必须是唯一的。

经过一番谷歌搜索后,我比以前更加困惑。我使用 SOAPUI 创建了一个模拟服务,该服务具有两个采用相同输入类型的操作,并且在没有定义肥皂操作的情况下,它始终选择相同的操作。当定义了动作后,它就可以正常工作。

我的问题是:

  • 您能否制作一个没有唯一soapActions 的WCF SOAP 服务(实际上保留原始WSDL 中定义的soapActions“''”)?
  • 如果没有定义soapAction,服务如何选择正确的操作?

编辑: 我无法控制 WSDL。我正在使用 WSCF.Blue 工具从 WSDL 文件创建服务存根。我也许能够修改 WSDL,但我想看看是否有可能保持原样。

I'm building a WCF SOAP application. The WSDL file has numerous operations of which many have the same argument type. The WSDL file defines all soapAction attributes as "''". When I try to start such a service WCF throw an exception saying that soapActions have to be unique.

After some googling I'm even more puzzled than before. I used SOAPUI to create a mock service with two operations which take the same input type and without the soapActions defined it always chooses the same operation. When the actions are defined it works fine.

My questions are:

  • Can you make a WCF SOAP service without unique soapActions (actually leaving the soapActions "''" as defined in the original WSDL)?
  • How can a service choose the right operation without the soapAction defined?

Edited:
I'm not in control of the WSDL. I'm using the WSCF.Blue tool to create a service stub from the WSDL file. I might be able to modify the WSDL, but I want to see if there is some possibility to leave it as it is.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

仅此而已 2024-10-29 01:09:59

您的问题不是很清楚,但我建议您基于某些定义的 WSDL 构建服务,不是吗?默认情况下,WCF 使用 SOAP 操作,因为它是 WCF 服务通过 BasicHttpBinding 提供的 WS-I Basic Profile 1.1 的必需部分。当操作由根主体元素定义时,将使用具有空 SOAP 操作的 WSDL。

WCF 示例提供了自定义 DispatchOperationSelector 的示例,它能够将消息路由到操作由它们的根体元素决定。这可能是您需要添加到服务中的内容,以便基于提供的 WSDL 的客户端可以调用它。

It is not very clear from your question but I suggest you are building service based on some defined WSDL, aren't you? WCF by default uses SOAP action because it is required part of WS-I Basic Profile 1.1 offered by WCF services with BasicHttpBinding. WSDLs with empty SOAP actions are used when the action is defined by root body element.

WCF samples provides example of custom DispatchOperationSelector which is able to route messages to operations by their root body element. This is probably what you need to add to your service so that clients based on provided WSDL can call it.

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