是否可以将WCF服务合同名称设置为空?

发布于 2024-12-27 09:53:23 字数 288 浏览 0 评论 0原文

我有一个旧的肥皂客户端,我需要构建肥皂服务。客户端需要两个 SOAPActions /connect 和 /disconnect。我有一个名为 IProto 的接口,它有两个函数连接和断开连接。问题在于 WCF 在 SOAPAction 中添加了服务契约名称 (IProto),并且客户端无法找到期望的操作。例如,服务 SOAPAction IProto/connect 和 IProto/disconnect 以及客户端需要 /connect 和 /disconnect。 有没有办法将服务合同名称设置为空?

附言。旧版客户端源代码无法更改。

I have a legacy soap client and I need to construct the soap service. There are two SOAPActions the client expects /connect and /disconnect. I have an interface called IProto which has two functions connect and disconnect. The problem is that WCF prepends Service contract name (IProto) in SOAPAction and the client cannot locate the expecting actions. For example service SOAPAction IProto/connect and IProto/disconnect and the client expects /connect and /disconnect.
Is there any way to set service contract name to empty?

PS. Legacy client source code cannot be altered.

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

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

发布评论

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

评论(4

难理解 2025-01-03 09:53:23

因此,您不想将 ServiceContract 名称设置为空,而是想更改 SOAPAction。提出正确的问题会让你的解决方案成功一半。

查看 OperationContract 的 Action 成员 属性。

[OperationContract(Action="/connect")]

So you don't want to set the ServiceContract name to empty, you want to alter the SOAPAction. Asking the right question brings you halfway to a solution.

Look at the Action member of the OperationContract attribute.

[OperationContract(Action="/connect")]
毁梦 2025-01-03 09:53:23

看起来 ServiceContract 属性具有您可以设置的属性实现这一点。

[ServiceContract(Name = "***", Namespace = "***")]

It looks like ServiceContract attribute has properties you can set to achieve this.

[ServiceContract(Name = "***", Namespace = "***")]
苍景流年 2025-01-03 09:53:23

替换 IDispatchOperationSelector 的默认实现?

Replace the default implementation of IDispatchOperationSelector?

时光瘦了 2025-01-03 09:53:23

尝试

[ServiceContract(Namespace = "")]
public interface IMyServiceContract

Try

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