W3C与 WSDL:服务描述、历史草案和2.0
保留1.1、1.2、2.0全部部件及架构资料,纠正记录与推荐混淆。
学完这一章,你能够
- 保留1.1、1.2、2.0全部部件及架构资料,纠正记录与推荐混淆。
- 保留1.1、1.2、2.0全部部件及架构资料,纠正记录与推荐混淆。
描述服务不是服务执行
WSDL以XML描述接口、消息/类型、绑定和端点;它不自动部署服务器、访问数据库或替用户完成调用。Web服务器/数据库/网关是一种应用架构,不是WSDL本身强制要求单独一台机器。
历史版本与工作范围
WSDL1.1 Note、Usage Scenarios、Requirements、Architecture、Glossary及后续场景资料保留;WSDL1.2的Core/Message Patterns/Bindings是历史草案路线,不能称最新。
WSDL2.0已有2007年的发布,包括Primer、Core、Adjuncts、SOAP1.1 Binding和RDF Mapping;不同部件可能是Note或资料性内容,不能把日期相同全算成规范性推荐。
地址和架构关联
WS-Addressing Core/SOAP Binding与Web Architecture各自有文档,不把它们改名成WSDL的私有语法。1.1的message/portType/port与2.0的interface/endpoint等不能混用一个命名空间。
本例只在自有描述里核对QName引用、接口/绑定/服务/端点关系;真实远程调用、数据库和企业网关部署不以文档结构验证代替。
历史规范逐项时间线(日期和阶段对应指定历史版本)
| 规范条目 | 官方版本名 | 日期 | 当时阶段 | 指定版本地址 |
| WSDL 1.1 Note | Web Services Description Language (WSDL) 1.1 | 2001-03-15 | Note | https://www.w3.org/TR/2001/NOTE-wsdl-20010315 |
| WSDL Usage Scenarios | Web Service Description Usage Scenarios | 2002-06-04 | Retired | https://www.w3.org/TR/2002/WD-ws-desc-usecases-20020604/ |
| WSDL Requirements | Web Services Description Requirements | 2002-10-28 | Retired | https://www.w3.org/TR/2002/WD-ws-desc-reqs-20021028/ |
| WSDL Architecture | Web Services Architecture | 2004-02-11 | Note | https://www.w3.org/TR/2004/NOTE-ws-arch-20040211/ |
| WSDL Glossary | Web Services Glossary | 2004-02-11 | Note | https://www.w3.org/TR/2004/NOTE-ws-gloss-20040211/ |
| WSDL Usage Scenarios | Web Services Architecture Usage Scenarios | 2004-02-11 | Note | https://www.w3.org/TR/2004/NOTE-ws-arch-scenarios-20040211/ |
| WSDL 1.2 Core Language | Web Services Description Language (WSDL) Version 1.2 Part 1: Core Language | 2003-06-11 | Working Draft | https://www.w3.org/TR/2003/WD-wsdl12-20030611 |
| WSDL 1.2 Message Patterns | Web Services Description Language (WSDL) Version 1.2 Part 3: Bindings | 2003-06-11 | Working Draft | https://www.w3.org/TR/2003/WD-wsdl12-bindings-20030611 |
| WSDL 1.2 Bindings | Web Services Description Language (WSDL) Version 1.2 Part 3: Bindings | 2003-06-11 | Working Draft | https://www.w3.org/TR/2003/WD-wsdl12-bindings-20030611 |
| WSDL 2.0 Primer | Web Services Description Language (WSDL) Version 2.0 Part 0: Primer | 2007-06-26 | Recommendation | https://www.w3.org/TR/2007/REC-wsdl20-primer-20070626/ |
| WSDL 2.0 Core Language | Web Services Description Language (WSDL) Version 2.0 Part 1: Core Language | 2007-06-26 | Recommendation | https://www.w3.org/TR/2007/REC-wsdl20-20070626/ |
| WSDL 2.0 Adjuncts | Web Services Description Language (WSDL) Version 2.0 Part 2: Adjuncts | 2007-06-26 | Recommendation | https://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626/ |
| WSDL 2.0 SOAP 1.1 Binding | Web Services Description Language (WSDL) Version 2.0 SOAP 1.1 Binding | 2007-06-26 | Note | https://www.w3.org/TR/2007/NOTE-wsdl20-soap11-binding-20070626/ |
| WSDL 2.0 RDF Mapping | Web Services Description Language (WSDL) Version 2.0: RDF Mapping | 2007-06-26 | Note | https://www.w3.org/TR/2007/NOTE-wsdl20-rdf-20070626/ |
| Web Services Addressing Core | Web Services Addressing 1.0 - Core | 2006-05-09 | Recommendation | https://www.w3.org/TR/2006/REC-ws-addr-core-20060509/ |
| Web Services Addressing SOAP Binding | Web Services Addressing 1.0 - SOAP Binding | 2006-05-09 | Recommendation | https://www.w3.org/TR/2006/REC-ws-addr-soap-20060509/ |
| Web Architecture | Architecture of the World Wide Web, Volume One | 2004-12-15 | Recommendation | https://www.w3.org/TR/2004/REC-webarch-20041215/ |
概念、用途与有效条件
| 术语/形式 | 含义及用途 | 边界 |
| definitions/message | 描述根/消息 | 本包1.1语法,与2.0不同 |
| portType/operation | 抽象操作 | QName必须解析 |
| binding/service/port | 绑定和地址 | 地址存在不等于请求成功 |
| WSDL1.1 | 历史Note | 不能说所有版本都是REC |
| RDF Mapping | 2007 Note | 与核心REC出版角色区分 |
本章独立核心源码与验证步骤
展开查看收起
python
from mbsky_lab import *
def resolve(node,value):
prefix,local=value.split(':',1);return node.nsmap[prefix],local
def run():
tree=etree.parse(str(P/'data/service.wsdl'),xml_parser());root=tree.getroot();ns={'w':'http://schemas.xmlsoap.org/wsdl/','s':'http://schemas.xmlsoap.org/wsdl/soap/'};target=root.get('targetNamespace');binding=root.find('w:binding',ns);port=root.find('w:service/w:port',ns);kind=resolve(binding,binding.get('type'));bound=resolve(port,port.get('binding'));assert kind==(target,'LearningPort')and bound==(target,'LearningBinding');assert root.xpath('count(w:portType/w:operation/w:input)',namespaces=ns)==1
for element in root.xpath('w:portType/w:operation/w:input|w:portType/w:operation/w:output',namespaces=ns):
uri,name=resolve(element,element.get('message'));assert uri==target and root.xpath('count(w:message[@name=$name])',namespaces=ns,name=name)==1
mapping=next(r for r in standards('w3c-wsdl')if r['label']=='WSDL 2.0 RDF Mapping');assert mapping['status']=='Note'
return {'WSDL11_QName_references_resolve':True,'input_output_messages':2,'binding_to_interface_and_service_to_binding_checked':True,'endpoint':'http://127.0.0.1:8780/learning','endpoint_not_contacted':True,'WSDL20_RDF_mapping_status':'Note','not_full_WSDL_schema_or_service_conformance':True,'historical_rows':len(standards('w3c-wsdl'))}
if __name__=='__main__':emit('w3c-wsdl',run)
查看独立实例 ↗ 在独立页面查看源码、运行环境与工程包
- 1.1消息、操作、绑定和端口QName关联成立;仅检查描述,不宣称端点运行。
本章附件与实例包
课程关联工程包(登记关联16章) · 含当前章节或实例 · mbskycom202611a441.zip
常见错误与边界检查
- 将历史文档日期/阶段当作现行状态,或把REC所有段落误当规范性要求。
- 用元数据/解析/局部运行代替整份规范语义验收及完整互操作性。
技术规范与官方资料
练习与参考解答
查看参考解答
对照指定版本、处理器、命名空间及失败条件,保持运行输入/输出/源码校验值对应。