简体   繁体   English

在WCF服务合同中使用soapAction =“”进行多个操作?

[英]Multiple Operations with soapAction=“” in a WCF Service Contract?

I need to create a service that will be "called back" by a third party. 我需要创建一个由第三方“回叫”的服务。 As a result, I need to conform to their WSDL. 因此,我需要遵循他们的WSDL。

Their WSDL has all of the operations defined with soapAction="" , so my service needs to do the same. 他们的WSDL具有使用soapAction=""定义的所有操作,因此我的服务需要执行相同的操作。 Unfortunately, I'm getting the error: 不幸的是,我收到了错误:

The operations A and B have the same action (). 操作A和B具有相同的动作()。 Every operation must have a unique action value. 每个操作都必须具有唯一的操作值。

In ASMX web services, there was a mode where the soapAction would not be used, but the name of the request element would be used instead. 在ASMX Web服务中,有一种模式不使用soapAction,但会使用请求元素的名称。 Is there some way using WCF not only to dispatch on the request element, but also to emit a WSDL with no soapAction? 有没有办法使用WCF不仅在请求元素上调度,而且还发出没有soapAction的WSDL?

This is possible in asmx, but out of the box you will find no clean way to do this in WCF because it uses the action to dispatch messages to operations. 这在asmx中是可行的,但是开箱即用,你会发现在WCF中没有干净的方法来执行此操作,因为它使用操作将消息分派给操作。

I think the hack you need is to set your soapAction to "*", and then write a custom dispatcher . 我认为您需要的hack是将soapAction设置为“*”,然后编写自定义调度程序

A potential side effect of this is a bad WSDL, if you need to expose a WSDL you will have to generate/steal it and then use the externalMetadataLocation attribute 这样做的一个潜在副作用是错误的WSDL,如果需要公开WSDL,则必须生成/窃取它,然后使用externalMetadataLocation属性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM