WSDL文件入门

在 WSDL 中,服务被定义为三个截然不同的部分(服务的地址,组成,绑定):

 

在 WSDL 中,服务被定义为三个截然不同的部分:

 

·   Port(功能:服务的地址)。Port 定义了可用服务的实际位置(端点)― 例如,SOAP 服务所在的 HTTP URL。

  <wsdl:service name="Math">

    <wsdl:port name="MathHttpPort" binding="tns:MathHttpBinding">

      <wsdlsoap:address location="http://localhost:8080/wsdemo/services/Math"/>

    </wsdl:port>

  </wsdl:service>

 

·   PortType(功能服务的组成)PortType 定义了由服务提供的抽象接口。一 PortType 定义了一组 Operation。每一个 operation 可能为 In-Out(请求-响应)、In-Only、Out-Only 或 Out-In(恳求-响应)。每一个 operation 定义了 input 和/或 output Message。一个 message 又是被定义为一组 Part,而每一个 part 有一个由模式定义的类型。

 

  <wsdl:portType name="MathPortType">

    <wsdl:operation name="Add">

      <wsdl:input name="AddRequest" message="tns:AddRequest"/>

      <wsdl:output name="AddResponse" message="tns:AddResponse"/>

    </wsdl:operation>

  </wsdl:portType>

 

  <wsdl:message name="AddResponse">

    <wsdl:part name="parameters" element="tns:AddResponse"/>

  </wsdl:message>

  <wsdl:message name="AddRequest">

    <wsdl:part name="parameters" element="tns:Add"/>

  </wsdl:message>

 

·   Binding(功能服务的映射)。一个 binding 定义了如何在一个抽象 PortType 与一个真实的服务格式和协议之间建立映射关系。例如,SOAP 绑定定义了编码风格、SOAPAction 头和 body(targetURI)的名称空间等等。

  <wsdl:binding name="MathHttpBinding" type="tns:MathPortType">

    <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:binding>

 

(结束)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值