WCF-> Websphere Integration Developer 和多态性
我有一个 .NET WCF 服务,它公开一个使用多态性的对象。
显然,Websphere Integration Developer 无法正确处理此问题(我不是 Websphere 开发人员),除非添加所有可能的多态性的所有字段并使用枚举等来表示它是某某类型的对象。
我简直不敢相信 IBM 创造了一款不支持多态性的产品! 所以..任何人都可以解释如何处理这个问题,或者指出我可以传递的资源吗?
I have a .NET WCF service which exposes an object that uses polymorphism.
Apparantly, Websphere Integration Developer is unable to handle this properly (I am not the Websphere developer), except by adding all fields of all possible polymorphisms and using a enum or such to say that it is an object of such and such type.
I can't possibly believe that IBM has created a product that doesn't support polymorphism! so.. Can anyone explain how to handle this, or point to resources which I can pass on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能不是问题,但您应该知道,Web 服务通常不支持虚拟方法。 因此,它们并不真正支持多态性。
事实上,Web 服务根本不是面向对象的。 它们都是关于 XML 的,而 XML 不是面向对象的。 与具有方法和属性的类的任何相似之处都是您的工具的想象 - 特别是生成代理类的工具会查看 Web 服务的 (XML) 描述并生成或多或少类似于所描述的类。
有时多,有时少。
This may not be the problem, but you should be aware that web services, in general, do not support virtual methods. As such, they don't really support polymorphism.
In fact, web services are not object oriented at all. They're all about XML, which is not object oriented. Any resemblance to classes with methods and properties is a figment of the imagination of your tools - specifically the tools that produce your proxy classes look at the (XML) description of the web service and produce classes that are more or less like what is described.
Sometimes more, and sometimes less.
问题是您的客户只能通过合同或 wsdl 了解您的服务。
wsdl 仅定义合约中方法的输入和输出(以及这些方法使用的数据合约) - 它不会公开服务类(或任何数据合约)的任何基类等)您的客户将致电。
并不是 WebSphere 无法处理多态性,而是 wsdl 无法按照您期望的方式表达多态性。
The problem is that your client only knows about your service via the contract or wsdl.
The wsdl just defines the inputs and outputs of the methods in your contract (as well as the data contracts used by those methods) - it doesn't expose any of the base classes, etc of the service class (or any of the data contracts) your client will be calling.
It's not that WebSphere can't handle polymorphism - it's more that the wsdl can't express it the way you might expect.