WSDL导入“位置"属性-vs- XSD导入"schemaLocation"属性 [英] WSDL import 'location' attribute -vs- XSD import 'schemaLocation' attribute

查看:297
本文介绍了WSDL导入“位置"属性-vs- XSD导入"schemaLocation"属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

两者之间的关系是什么?

What is the relationship between:

-和-

import元素和 XML模式

...,尤其是前者的location属性和后者的schemaLocation属性之间的关系?

... and in particular the relationship between the location attribute of the former and the schemaLocation attribute of the latter?

尽管我可以使用目录文件(在JAX-WS/wsimport工具链中)以覆盖" xsd:import元素的schemaLocation属性,看来我不能对wsdl:import声明.

Though I can use a catalog file (in a JAX-WS / wsimport toolchain) to "override" schemaLocation attributes for the xsd:import element it seems that I can't do the same for the location attributes of the wsdl:import statement.

推荐答案

在两种情况下,import都会在文档(是WSDL或XSD)与外部资源之间建立关系.

In both cases, the import establishes a relationship between a document (be that WSDL or XSD) and an external resource).

除非围绕 wsdl:import 的混乱,特别是是否可以将其用于导入XSD(在

Barring the confusion which surrounded the wsdl:import, specifically if it could be used to import XSDs or not (in the interoperable way it shouldn't), they're both meant to do the same thing for its own kind, i.e. bring in another WSDL's (in the WSDL case), or another XSD's (in the XSD case) definitions in scope, thus allowing a modular approach to authoring.

您所指的属性是等效的,就像Java中的import或多或少与C#中的using匹配一样.

The attributes you're referring to are meant to be equivalent, in the same way an import in Java more or less matches a using in C#.

但是,如果您考虑WSDL 1.1注释,则每个细节的细节是不同的:在XSD中, schemaLocation 属性对于xsd:import是可选的(因为导入的位置可以通过使用它的命名空间来解析规范允许的其他方式), WSDL 1.1注释作为位置属性.

However, the specifics around each are different if you consider the WSDL 1.1 note: while in XSD the schemaLocation attribute is optional for xsd:import (since an import's location may be resolved through its namespace using other means allowed by the spec), the same was not built into the WSDL 1.1 note for the location attribute.

此外,XSD规范明确允许覆盖:

Also, the XSD spec is explicitly allowing for an override:

The ·actual value· of the schemaLocation, if present, gives a **hint** as to where a serialization of a ·schema document·...

如果您在WSDL 2.0中寻找相同的内容,您会发现现在WSDL除了旧的 import 外还支持 include ,基本上遵循与指令关联的名称空间相同的语义.更重要的是,location属性的使用也与XSD中的使用一致,作为回报,XSD应该采用基于目录的方法来解决悬空"的导入.

If you look for the same in WSDL 2.0, you will notice that now WSDL supports an include in addition to the old import, basically following the same semantics relative to the namespace associated with the directive. More so, the use of the location attribute is also consistent to that in the XSD, which in return should foster a catalog-based approach to resolve the "dangling" imports.

对此进行总结,考虑到WSDL 1.1中的强制性 location 属性,由于注释未暗示或不允许使用目录或替代项,因此没有意义.

To round it up, given the mandatory location attribute in WSDL 1.1, it didn't make sense to talk about catalogs or overrides since it was not implied or allowed by the note.

这篇关于WSDL导入“位置"属性-vs- XSD导入"schemaLocation"属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆