什么标准指定如何在 WSDL 中指示 MTOM/XOP 支持?
我正在将 MTOM 附件支持添加到本地应用程序服务器中的现有 Web 服务支持中。 Webservice 框架遵循与 JavaEE5 类似的模式,即带注释的服务和服务。对象通过自动 WSDL 生成自动公开为 WebService。
我已经进行了实际的解析和生成,但我无法确定是否需要更新 WSDL 生成以向客户表明 MTOM 受支持且首选。我一直在寻找关于如何指示 MTOM 支持的多个相互冲突的标准,并且我对现实世界中使用的标准感到困惑。
到目前为止,我发现:
- MTOM 序列化策略断言 (WS- MTOMPolicy) 版本 1.0 - 来自 XML Soap
- MTOM 序列化策略断言 1.1 - 来自 W3C
据我所知,W3c 似乎是 XMLSoap 的更高版本,但是它们似乎在不同的命名空间中使用不同的元素来进行断言:
- W3C 在 http://www.w3.org/2007/08/soap12-mtom-policy 命名空间
- XML Soap 在 http://schemas.xmlsoap.org/ 中使用 OptimizedMimeSerialization ws/2004/09/policy/optimizedmimeserialization 命名空间
我也喜欢 随机论坛帖子 似乎表明 Glassfish 正在使用 XML Soap。 W3C 标准是一个草案,但似乎是 2007 年以来的草案。
有谁知道这些规范中的哪一个被普遍使用?或者当涉及到 MTOM 时通常忽略 WSDL?
I'm adding MTOM attachment support into existing webservice support in a Home Grown appserver. The webservice framework follows a similar pattern to JavaEE5, annotated services & objects being automatically exposed as a WebService with automatic WSDL generation.
I've got the actual parsing and generation going, but I've been unable to determine if I need to update the WSDL generation to indicate to clients that MTOM is supported and preferred. I've been finding multiple conflicting standards for how to Indicate MTOM support and I'm at a loss as to what's used in the real world.
So far I've found:
- MTOM Serialization Policy Assertion (WS-
MTOMPolicy) Version 1.0 - From XML Soap - MTOM Serialization Policy Assertion 1.1 - From W3C
As far as I can see, the W3c one appears to be a later version of the XMLSoap one, however they seem to use a different element in a different namespace for the assertion:
- W3C uses - MTOM in the http://www.w3.org/2007/08/soap12-mtom-policy namespace
- XML Soap uses - OptimizedMimeSerialization in the http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization namespace
I've also fond a random forum post which seems to indicate that Glassfish was using the XML Soap one. The W3C standard is a draft, but seems to have been a draft sine 2007.
Does anyone know which of these specs is generally in use? Or is it common to just ignore the WSDL when it comes to MTOM?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于这个问题在这里已经风滚草,所以我决定以防其他人偶然发现这个问题。
看来原始帖子中链接的 W3C 规范已经停滞不前,因为它仍处于草案阶段。还有一个针对 WSDL2 的 W3C 规范,其中包括指示 MTOM 支持的特定属性,但是 WSDL2 似乎并未在实际使用中。
由于这一点以及 Glassfish 使用它的迹象,我选择了问题中链接的 XmlSoap 规范。然而,我实际上还没有找到任何真正解释 MTOM 断言的工具或客户端,而是我遇到的客户端工具要求您明确指示它们是否应该对请求进行 MTOM 编码。因此,包含这一断言似乎有点没有实际意义。
不过需要注意的是,虽然 JAX-WS 似乎没有使用 MTOM 断言,但它确实使用了 PolicyAssertions 来确保安全。任何 PolicyAssertions 的存在意味着 JAX-WS 会忽略任何显式指定的安全配置。因此,指定 MTOM 断言而不包含安全断言会阻止 Web 服务被调用(如果 Web 服务以任何方式受到保护)。我不确定这个问题是否也适用于其他客户端工具。
Since this question has tumbleweeded here is what I decided incase anyone else stumbles across this.
It appears that the W3C Spec linked to in the original post has stagnated since it's still in draft. There is also a W3C Spec for WSDL2 which includes a specific attribute to indicate MTOM support, however WSDL2 doesn't appear to be in use in the wild.
As a result of this and the indications that it's used by Glassfish I opted for the XmlSoap spec linked to in the question. However I haven't actually found any tools or clients that actually interpret the MTOM assertion, rather the client tools I've come across ask you to explicitly indicate whether they should MTOM encode the request or not. So including this assertion appears to be a bit of a moot point.
A word of warning though, while JAX-WS doesn't appear to use the MTOM assertion it does use the PolicyAssertions for security. The presence of any PolicyAssertions means that JAX-WS ignores any explicitly specified security configuration. So specifying the MTOM assertion without also including the security assertions prevents the web-service being called if it is secured in any way. I'm uncertain if this issue also applies to other client tools.