Atitit wsdl的原理attilax总结

 

 

 

Atitit wsdl的原理attilax总结

 

 

1.1. W3C 的 WSDL 发展史1

1.2. 获取wsdl,可能需要url后面加wsdl,也可能直接url1

1.3. Wsdl的作用2

1.4. WSDL 文档结构2

1.5. WSDL 端口2

1.6. WSDL 消息2

1.7. WSDL types2

1.8. WSDL Bindings2

1.9. WSDL 实例3

1.10. 操作类型3

1.11. 绑定到 SOAP4

 

 

1.1.  W3C 的 WSDL 发展史

2001 3 月,WSDL 1.1 IBM、微软作为一个 W3C 记录(W3C note)提交到有关 XML 协议的 W3C XML 活动,用于描述网络服务。

W3C 记录仅供讨论。一项 W3C 记录的发布并不代表它已被 W3C W3C 团队亦或任何 W3C 成员认可。)

2002 7 月,W3C 发布了第一个 WSDL 1.2 工作草案。

 

1.2. 获取wsdl,可能需要url后面加wsdl,也可能直接url

http://www.onvif.org/ver10/media/wsdl/media.wsdl

 

 

1.3. Wsdl的作用

客户端可以更具wsdl gene client stub..yanen no use stub...dyna invoke wsdl ...remote itfs...

 

 

1.4. WSDL 文档结构

WSDL 文档是利用这些主要的元素来描述某个 web service 的:

元素

定义

<portType>

web service 执行的操作

<message>

web service 使用的消息

<types>

web service 使用的数据类型

<binding>

web service 使用的通信协议

 

 

 

1.5. WSDL 端口

<portType> 元素是最重要的 WSDL 元素。

它可描述一个 web service、可被执行的操作,以及相关的消息。

可以把 <portType> 元素比作传统编程语言中的一个函数库(或一个模块、或一个类)。

1.6. WSDL 消息

<message> 元素定义一个操作的数据元素。

每个消息均由一个或多个部件组成。可以把这些部件比作传统编程语言中一个函数调用的参数。

1.7. WSDL types

<types> 元素定义 web service 使用的数据类型。

为了最大程度的平台中立性,WSDL 使用 XML Schema 语法来定义数据类型。

1.8. WSDL Bindings

<binding> 元素为每个端口定义消息格式和协议细节。

 

 

 

1.9. WSDL 实例

这是某个 WSDL 文档的简化的片段:

<message name="getTermRequest">

   <part name="term" type="xs:string"/>

</message>

 

<message name="getTermResponse">

   <part name="value" type="xs:string"/>

</message>

 

<portType name="glossaryTerms">

  <operation name="getTerm">

        <input message="getTermRequest"/>

        <output message="getTermResponse"/>

  </operation>

</portType>

在这个例子中,<portType> 元素把 "glossaryTerms" 定义为某个端口的名称,把 "getTerm" 定义为某个操作的名称。

操作 "getTerm" 拥有一个名为 "getTermRequest" 输入消息,以及一个名为 "getTermResponse" 输出消息

<message> 元素可定义每个消息的部件,以及相关联的数据类型。

对比传统的编程,glossaryTerms 是一个函数库,而 "getTerm" 是带有输入参数 "getTermRequest" 和返回参数 getTermResponse 的一个函数

 

 

端口定义了指向某个 web service 的连接点。可以把该元素比作传统编程语言中的一个函数库(或一个模块、或一个类),而把每个操作比作传统编程语言中的一个函数。

1.10. 操作类型

请求-响应是最普通的操作类型,不过 WSDL 定义了四种类型:

类型

定义

One-way

此操作可接受消息,但不会返回响应。

Request-response

此操作可接受一个请求并会返回一个响应

Solicit-response

此操作可发送一个请求,并会等待一个响应。

Notification

此操作可发送一条消息,但不会等待响应。

 

 

 

WSDL 绑定可为 web service 定义消息格式和协议细节。

1.11. 绑定到 SOAP

一个 请求 - 响应 操作的例子:

<message name="getTermRequest">

   <part name="term" type="xs:string" />

</message>

 

<message name="getTermResponse">

   <part name="value" type="xs:string" />

</message>

 

<portType name="glossaryTerms">

  <operation name="getTerm">

      <input message="getTermRequest" />

      <output message="getTermResponse" />

  </operation>

</portType>

 

<binding type="glossaryTerms" name="b1">

<soap:binding style="document"

transport="http://schemas.xmlsoap.org/soap/http" />

  <operation>

    <soap:operation

     soapAction="http://example.com/getTerm" />

    <input>

      <soap:body use="literal" />

    </input>

    <output>

      <soap:body use="literal" />

    </output>

  </operation>

</binding>

binding 元素有两个属性 - name 属性和 type 属性。

name 属性定义 binding 的名称,而 type 属性指向用于 binding 的端口,在这个例子中是 "glossaryTerms" 端口。

soap:binding 元素有两个属性 - style 属性和 transport 属性。

style 属性可取值 "rpc" "document"。在这个例子中我们使用 documenttransport 属性定义了要使用的 SOAP 协议。在这个例子中我们使用 HTTP

operation 元素定义了每个端口提供的操作符。

对于每个操作,相应的 SOAP 行为都需要被定义。同时您必须如何对输入和输出进行编码。在这个例子中我们使用了 "literal"

 

 

WSDL 简介.html

 

作者:: 绰号:老哇的爪子claw of Eagle 偶像破坏者Iconoclast image-smasher

捕鸟"Bird Catcher 王中之王King of Kings 虔诚者Pious 宗教信仰捍卫者 Defender of the Faith. 卡拉卡拉红斗篷 Caracalla red cloak

简称: Emir Attilax Akbar 埃米尔 阿提拉克斯 阿克巴

全名:Emir Attilax Akbar bin Mahmud bin  attila bin Solomon bin adam Al Rapanui 

埃米尔 阿提拉克斯 阿克巴  马哈茂德  阿提拉 所罗门 本亚当 阿尔 拉帕努伊   

常用名艾提拉(艾龙)   EMAIL:1466519819@qq.com

头衔:uke总部o2o负责人,全球网格化项目创始人,uke宗教与文化融合事务部部长,Uke部落首席大酋长,uke制度与重大会议委员会委员长,uke保安部首席大队长,uke制度检查委员会副会长,奶牛科技cto uke波利尼西亚区大区连锁负责人,克尔格伦群岛连锁负责人,莱恩群岛连锁负责人,uke汤加王国区域负责人。布维岛和南乔治亚和南桑威奇群岛大区连锁负责人

 

转载请注明来源:attilax的专栏   http://www.cnblogs.com/attilax/

--Atiend

 

 

posted @ 2016-12-16 13:48  attilaxAti  阅读(298)  评论(0编辑  收藏  举报