`
ahzzhen2
  • 浏览: 18871 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

WSDL接口文件组成结构图(转)

    博客分类:
  • Java
 
阅读更多

types:定义作为服务一部分进行交换的消息中包含的数据类型。数据类型可以是简单、复杂、派生或者数组类型。在 WSDL 文档的消息元素中引用的类型(架构定义或参考)是在该 WSDL 文档的类型元素中定义的。

message:定义该服务交换的消息。WSDL 文档对于每个交换消息有一个消息元素,并且该消息元素包括与 \\ 消息相关的数据类型。例如,在清单 1 中,第一个消息包括单个部分,它属于类型字符串。

portType:以抽象方式指定作为该服务一部分的操作和消息。对于它定义的每项服务,WSDL 文档都有一个或多个 portType 定义。在清单 1 中,仅定义了一个端口类型,即 WeatherService。

binding:将抽象的端口类型与其消息和操作绑定到传输协议和消息格式。在清单 1 中,定义了一个操作 getWeather,它同时具有输入和输出消息。这两则消息都以 SOAP 正文格式交换。绑定传输协议是 HTTP。

service 和 port:通过为绑定提供单一地址,定义实际服务的名称并为该服务指定一个端点。一个端口只能有一个地址。该 service 元素通过名称属性将相关端口组合在一起,为该服务提供逻辑名称。在清单 1 中,定义了一个名为 WeatherWebService 的服务,该服务具有地址为 http://mycompany.com/weatherservice 的单一端口(或端点)。

<?xml version=’1.0’ encoding=’UTF-8’?>
  <definitions name =’WeatherWebService
           targetNamespace=’urn:WeatherWebService’
           xmlns:tns=’urn:WeatherWebService’
           xmlns=’http:/schemas.xmlsoap.org/wsdl/’
           xmlns:xsd=’http://www.w3.org/2001/XMLSchema’
           xmlns:soap=’http://schemas.xml.soap.org/wsdl/soap/’
   <types/>
   <message name=’WeatherService_getWeather’>
    <part name=’City’ type=’xsd:string’/>
   </message>
   <message name=’WeatherService_getWeatherResponse’>
    <part name=’result’ type=’xsd:string’/>
   </message>
   <portType name=’WeatherService’>
    <operation name=’getWeather’ parameterOrder=’City’>
     <input message=’tns:WeatherService_getWeather’/>
     <output message=’WeatherService_getWeatherResponse/>
    </operation>
   </portType>
   <binding name=’WeatherServiceBinding’ type=’tns:WeatherService’>
    <operation name=’getWeather’>
      <input>
       <soap:body use=’literal’  namespace=’urn:WeatherWebService’/>
      </input>
      <output>
       <soap:body use:literal namespace=’urn:WeatherWebService’/>
      </output>
      <soap:operation soapAction=’’/>
    </operation>
    <soap:binding transport=’http://schemas.xmlsoap.ord/soap/http’    style=’rpc’/>
   </binding>
   <service name=’WeatherWebService’>
    <port name=’WeatherServicePort’ binding=’tns:WeatherServiceBinding’>
      <soap:address location=http://mycompany.com/weatherservice’/>
    </port>
   </service>

 

清单1

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics