WCF 如何决定分派到哪个操作?
我正在构建一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题不是很清楚,但我建议您基于某些定义的 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.