有关 Web 服务(或 WCF)元数据的问题
这些问题可能看起来很愚蠢,但我仍然想弄清楚这些事情:
- Web 服务元数据包含什么以及为什么需要元数据?
- 它是否包含与 Web 服务公开的操作不同的内容?
- 创建 Web 服务时,我们在哪里定义/提及 Web 服务的元数据
- 从 Web 服务生成的 WSDL 是否包含 Web 服务元数据?
- 如果有一个选项可以向客户端隐藏元数据,那么这是否意味着它不是强制性的?
These may appear silly questions but still i would like to get these things cleared:
- What do web service metadata comprise and why is metadata necessary?
- Does it contain something other/different than the operations a web service expose?
- Where do we define/mention the metadata of the web service while creating the web service
- Does WSDL generated out of the Web Service contains web service metadata?
- If there is an option to hide metadata from clients, then does it mean that it's something which is not mandatory to have?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Web服务元数据描述了服务,例如,它允许其他机器(或用户)找出
是的,元数据是可选的 - 如果您“隐藏”它或不公开它,那么第三方就无法“发现”并使用您的服务 - 您必须提供一些其他方式让他们使用您的服务服务(您可以向他们发送打印文档,您可以将生成的 WSDL/XSD 作为文件附件通过电子邮件或其他方式发送)。
在 WCF 中,您可以非常轻松地控制公开哪种元数据(如果有) - 您可以一起启用/禁用服务元数据,您可以定义客户端只能使用本机 WCF 元数据交换 (MEX) 协议,或者您可以还可以向感兴趣的调用者公开您的 WSDL(从正在运行的服务动态生成,或者外部静态文件)。
我从来没有在 ASMX Web 服务方面做过太多工作,而且我不了解其他系统,所以我无法真正告诉您有关这些系统的所有信息。我从经验中确实知道,一些服务产品确实公开了他们的 WSDL 作为发现和使用服务的手段,而其他服务则对此非常偏执,您需要致电他们/向他们发送电子邮件以通过电子邮件获取 WSDL/XSD邮件 - 您无法直接发现和使用他们的服务。
Web Service metadata describes the service, e.g. it allows other machines (or users) to find out
Yes, metadata is optional - if you "hide" it or don't expose it, then a third-party cannot "discover" and use your service - you would have to provide some other means for them to use your service (you could send them printed documentation, you could send the generated WSDL/XSD as file attachments in an e-mail or whatever).
In WCF, you can quite easily control what kind of metadata is exposed (if any) - you can enable/disable service metadata alltogether, you can define that clients are able to use just the native WCF Metadata Exchange (MEX) protocol, or you can also expose your WSDL (either dynamically generated from your running service, or an external, static file) to interested callers.
I never did much work in ASMX web services, and I don't know other systems, so I cannot really tell you all that much about those. I do know from experience that some service offerings do expose their WSDL as a mean to discover and use the service, while others are pretty paranoid about it and you need to call them / e-mail them to get the WSDL/XSD via e-mail - you cannot discover and use their services directly.