使用soapAction =“"的多个操作在 WCF 服务合同中? [英] Multiple Operations with soapAction="" in a WCF Service Contract?

查看:32
本文介绍了使用soapAction =“"的多个操作在 WCF 服务合同中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个将由第三方回调"的服务.因此,我需要符合他们的 WSDL.

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 具有用 soapAction="" 定义的所有操作,所以我的服务需要做同样的事情.不幸的是,我收到了错误:

Their WSDL has all of the operations defined with soapAction="", so my service needs to do the same. Unfortunately, I'm getting the error:

操作 A 和B 有同样的动作().每一次操作必须具有唯一的操作值.

The operations A and B have the same action (). Every operation must have a unique action value.

在 ASMX 网络服务中,有一种模式不会使用soapAction,而是使用请求元素的名称.有没有什么方法可以使用 WCF 不仅在请求元素上进行分派,而且还可以在没有soapAction 的情况下发出 WSDL?

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. Is there some way using WCF not only to dispatch on the request element, but also to emit a WSDL with no soapAction?

推荐答案

这在 asmx 中是可能的,但是在 WCF 中您会发现没有开箱即用的方法来执行此操作,因为它使用操作将消息分派给操作.

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.

我认为您需要的技巧是将您的soapAction 设置为*",然后编写一个自定义调度程序.

I think the hack you need is to set your soapAction to "*", and then write a custom dispatcher.

这样做的潜在副作用是糟糕的 WSDL,如果您需要公开 WSDL,则必须生成/窃取它,然后使用 externalMetadataLocation 属性

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

这篇关于使用soapAction =“"的多个操作在 WCF 服务合同中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆