拒绝名称空间仅在文件扩展名(最后一个点之后的部分)不同的 WSDL 是否合法?
Is it legal to reject WSDLs where namespaces differs only in file extension (the part after the last dot)?
我有一个使用许多 Web 服务的复杂 Web 应用程序。我必须开始使用一个新的。这个新服务的 WSDL 定义了一个目标名称空间,它几乎与旧 WSDL 中使用的名称空间相同。只有最后一个点之后的部分不同。
JAXB推导出来的包名是一样的,第二个生成的ObjectFactory覆盖了另一个。
例如,一个 wsdl 有一个目标名称空间“http://foo.com/a.b.c", another one has "http://foo.com/a.b.c_2”。然后 java 两个名称空间的包名称将是 com.foo.a.b,这是一种冲突。
我检查了 JAXB 规范并发现了这个 (https://download.oracle.com/otn-pub/jcp/jaxb-2.0-fr-eval-oth-JSpec/jaxb-2_0-fr-spec.pdf?AuthParam=1542978637_f7c18a1892b0ff022071acdab6259bdd):
D.5.1 Mapping from a Namespace URI An XML namespace is represented by
a URI. Since XML Namespace will be mapped to a Java package, it is
necessary to specify a default mapping from a URI to a Java package
name. The URI format is described in [RFC2396]. The following steps
describe how to map a URI to a Java package name. The example URI,
http://www.acme.com/go/espeak.xsd, is used to illustrate each step.
Remove the scheme and ":" part from the beginning of the URI, if present. Since there is no formal syntax to identify the optional URI
scheme, restrict the schemes to be removed to case insensitive checks
for schemes “http” and “urn”.
//www.acme.com/go/espeak.xsd
Remove the trailing file type, one of .?? or .??? or .html.
//www.acme.com/go/espeak
...
我这边可能有解决方法,但我希望 Web 服务提供商通过使用 "proper" 名称空间来解决 "correct" 这种情况,这些名称空间仅在最后一部分(JAXB 用语中的文件扩展名?)。
我正在寻找 "my case" 的参数。
请参阅Namespaces in XML 1.0 §2.3 Comparing URI References:
URI references identifying namespaces are compared when determining whether a name belongs to a given namespace, and whether two names belong to the same namespace. [Definition: The two URIs are treated as strings, and they are identical if and only if the strings are identical, that is, if they are the same sequence of characters. ] The comparison is case-sensitive, and no %-escaping is done or undone.
如果您的命名空间 "only differ in file extension",这些是不同的命名空间。如果您的工具为它们生成相同的包,则问题在您这边,而不是在 WSDL 作者这边。
所以不,你没有很好的理由支持 "your case",抱歉。
修复很简单:只需为每个命名空间配置目标包。例如看下面的问题:
CXF: How to change package of WSDL imported XML Schema using JAXB external binding file?
我有一个使用许多 Web 服务的复杂 Web 应用程序。我必须开始使用一个新的。这个新服务的 WSDL 定义了一个目标名称空间,它几乎与旧 WSDL 中使用的名称空间相同。只有最后一个点之后的部分不同。
JAXB推导出来的包名是一样的,第二个生成的ObjectFactory覆盖了另一个。
例如,一个 wsdl 有一个目标名称空间“http://foo.com/a.b.c", another one has "http://foo.com/a.b.c_2”。然后 java 两个名称空间的包名称将是 com.foo.a.b,这是一种冲突。
我检查了 JAXB 规范并发现了这个 (https://download.oracle.com/otn-pub/jcp/jaxb-2.0-fr-eval-oth-JSpec/jaxb-2_0-fr-spec.pdf?AuthParam=1542978637_f7c18a1892b0ff022071acdab6259bdd):
D.5.1 Mapping from a Namespace URI An XML namespace is represented by a URI. Since XML Namespace will be mapped to a Java package, it is necessary to specify a default mapping from a URI to a Java package name. The URI format is described in [RFC2396]. The following steps describe how to map a URI to a Java package name. The example URI, http://www.acme.com/go/espeak.xsd, is used to illustrate each step.
Remove the scheme and ":" part from the beginning of the URI, if present. Since there is no formal syntax to identify the optional URI scheme, restrict the schemes to be removed to case insensitive checks for schemes “http” and “urn”.
//www.acme.com/go/espeak.xsd
Remove the trailing file type, one of .?? or .??? or .html.
//www.acme.com/go/espeak
...
我这边可能有解决方法,但我希望 Web 服务提供商通过使用 "proper" 名称空间来解决 "correct" 这种情况,这些名称空间仅在最后一部分(JAXB 用语中的文件扩展名?)。
我正在寻找 "my case" 的参数。
请参阅Namespaces in XML 1.0 §2.3 Comparing URI References:
URI references identifying namespaces are compared when determining whether a name belongs to a given namespace, and whether two names belong to the same namespace. [Definition: The two URIs are treated as strings, and they are identical if and only if the strings are identical, that is, if they are the same sequence of characters. ] The comparison is case-sensitive, and no %-escaping is done or undone.
如果您的命名空间 "only differ in file extension",这些是不同的命名空间。如果您的工具为它们生成相同的包,则问题在您这边,而不是在 WSDL 作者这边。
所以不,你没有很好的理由支持 "your case",抱歉。
修复很简单:只需为每个命名空间配置目标包。例如看下面的问题:
CXF: How to change package of WSDL imported XML Schema using JAXB external binding file?