简要描述wsdl

使用webservice也已经有一段时间了,现在比较清闲,书写一下自己的心得。
wsdl(Web Service Description Language),描述怎样提供网络服务,包括与什么协议进行绑定、参数类型、校验(schema)、访问入口等等。
wsdl的元素类型如下:
type、message、operation porttype(这四个元素是抽象的,只是定义一种描述)
service binding port是具体的实现
之间的依赖关系如下(图使用ppt作的,比较丑^_^)
[img] http://pippo25.iteye.com/upload/picture/pic/13369/9b057d82-49f9-3a7a-9a19-f346068d1fbe.jpg [/img]
1.types:分为imapleType 和 complesType两种,如:
<element name="add">
<complexType>
<sequence>
<element name="x" type="xsd:int"/>
<element name="y" type="xsd:int"/>
</sequence>
</complexType>
</element>

2.Message:描述消息,使用types类型定义的参数组成消息
如:
<wsdl:message name="addRequest">

<wsdl:part element="impl:add" name="parameters"/>

</wsdl:message>

3.Operation:描述操作。使用message描述的参数。定义了一个访问入口的 请求/响应消息对。
如:
<wsdl:operation name="subtract">

<wsdl:input message="impl:subtractRequest" name="subtractRequest"/>

<wsdl:output message="impl:subtractResponse" name="subtractResponse"/>

</wsdl:operation>

4.porttype:定义了所有操作的集合,由operation组成。
如:
<wsdl:portType name="EngineImpl">

<wsdl:operation name="add">

<wsdl:input message="impl:addRequest" name="addRequest"/>

<wsdl:output message="impl:addResponse" name="addResponse"/>

</wsdl:operation>

<wsdl:operation name="subtract">

<wsdl:input message="impl:subtractRequest" name="subtractRequest"/>

<wsdl:output message="impl:subtractResponse" name="subtractResponse"/>

</wsdl:operation>

<wsdl:operation name="divide">

<wsdl:input message="impl:divideRequest" name="divideRequest"/>

<wsdl:output message="impl:divideResponse" name="divideResponse"/>

</wsdl:operation>

<wsdl:operation name="multiply">

<wsdl:input message="impl:multiplyRequest" name="multiplyRequest"/>

<wsdl:output message="impl:multiplyResponse" name="multiplyResponse"/>

</wsdl:operation>

</wsdl:portType>

上面的四个元素只是描述,没有涉及到真正的服务实现方式。
5.Service:相关服务访问点的集合。
6.Binding:结构定义了某个PortType与某一种具体的网络传输协议或消息传输协议相绑定,从这一层次开始,描述的内容就与具体服务的部署相关了。比如可以将PortType与SOAP/HTTP绑定,也可以将PortType与MIME/SMTP相绑定等。
如:
<wsdl:binding name="EngineImplSoapBinding" type="impl:EngineImpl">

<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="add">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="addRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:output name="addResponse">

<wsdlsoap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

<wsdl:operation name="subtract">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="subtractRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:output name="subtractResponse">

<wsdlsoap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

<wsdl:operation name="divide">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="divideRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:output name="divideResponse">

<wsdlsoap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

<wsdl:operation name="multiply">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="multiplyRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:output name="multiplyResponse">

<wsdlsoap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

7.port:Port描述的是一个服务访问入口的部署细节,包括通过哪个Web地址(URL)来访问,应当使用怎样的消息调用模式来访问等。其中消息调用模式则是使用Binding结构来表示。
如:
<wsdl:port binding="impl:EngineImplSoapBinding" name="EngineImpl">

<wsdlsoap:address location="http://localhost:8010/WebService/services/EngineImpl"/>

</wsdl:port>


一个WSDL中,definition是整个文档的根元素,一个文档中可能存在多个Service元素,service是服务的入口点。 Service 中可能有多个port,每个port对应一个PortType,PortType可能对应一组operation
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值