SOAP(wsdl)

来源:互联网 发布:淘宝交易怎么做 编辑:程序博客网 时间:2024/05/21 08:25

http://zh.wikipedia.org/zh-cn/SOAP
http://www.w3school.com.cn/
http://www.ibm.com/developerworks/cn/xml/x-sisoap/
http://blog.csdn.net/qjyong/article/details/2148558
http://www.w3school.com.cn/index.html
http://www.w3.org/TR/wsdl#_messages


一、SOAP(Simple Object Access Protocol ):

简单对象访问协议是在分散或分布式的环境中交换信息的简单的协议,是一个基于XML的协议,它使应用程序通过 HTTP(SMTP,FTP等协议) 来交换信息。或者更简单地说:SOAP 是用于访问网络服务的协议。

目前的应用程序通过使用远程过程调用(RPC)在诸如 DCOM 与 CORBA 等对象之间进行通信,但是 HTTP 不是为此设计的。RPC 会产生兼容性以及安全问题;防火墙和代理服务器通常会阻止此类流量。

通过 HTTP 在应用程序间通信是更好的方法,因为 HTTP 得到了所有的因特网浏览器及服务器的支持。SOAP 就是被创造出来完成这个任务的。

    • SOAP 指简易对象访问协议
    • SOAP 是一种通信协议  --- 其传输的xml可以作为RPC进行解析;也可以使用Apache xerces xml解析器自行解析处理!
    • SOAP 用于应用程序之间的通信
    • SOAP 是一种用于发送消息的格式
    • SOAP 被设计用来通过因特网进行通信
    • SOAP 独立于平台
    • SOAP 独立于语言
    • SOAP 基于 XML
    • SOAP 很简单并可扩展
    • SOAP 允许您绕过防火墙
    • SOAP 将被作为 W3C 标准来发展
    1. SOAP 消息必须用 XML 来编码
    2. SOAP 消息必须使用 SOAP Envelope 命名空间
    3. SOAP 消息必须使用 SOAP Encoding 命名空间
    4. SOAP 消息不能包含 DTD 引用
    5. SOAP 消息不能包含 XML 处理指令

SOAP简单的理解,就是这样的一个开放协议SOAP=RPC+HTTP+XML:采用HTTP作为底层通讯协议;RPC作为一致性的调用途径,XML作为数据传送的格式,允许服务提供者和服务客户经过防火墙在INTERNET进行通讯交互。RPC的描叙可能不大准确,因为SOAP一开始构思就是要实现平台与环境的无关性和独立性,每一个通过网络的远程调用都可以通过SOAP封装起来,包括DCE(Distributed Computing Environment ) RPC CALLS,COM/DCOM CALLS, CORBA CALLS, JAVA CALLS,etc。

SOAP 是微软 .net 架构的关键元素,用于未来的因特网应用程序开发。


二、WSDL (Web Services Description Language):

  • 网络服务描述语言,是基于 XML 的用于描述 Web Services 以及如何访问 Web Services 的语言。它可规定服务的位置,以及此服务提供的操作(或方法)。
  • WSDL 指网络服务描述语言
  • WSDL 使用 XML 编写
  • WSDL 是一种 XML 文档
  • WSDL 用于描述网络服务
  • WSDL 也可用于定位网络服务
  • WSDL 还不是 W3C 标准
  • Services are defined using six major elements:

    • types, which provides data type definitions used to describe the messages exchanged.
    • message, which represents an abstract definition of the data being transmitted. A message consists of logical parts, each of which is associated with a definition within some type system.
    • portType, which is a set of abstract operations. Each operation refers to an input message and output messages.
    • binding, which specifies concrete protocol and data format specifications for the operations and messages defined by a particular portType.
    • port, which specifies an address for a binding, thus defining a single communication endpoint.    the purpose of the SOAP binding element is to signify that the binding is bound to the SOAP protocol format: Envelope, Header and Body. 
    • service, which is used to aggregate a set of related ports.
三、几个个人疑惑点:
    <message name="nmtoken"> *
        <part name="nmtoken" element="qname"?还是 type="qname"?/> *
    </message>
用element?还是用type?看http://www.w3.org/TR/wsdl#_soap-b中2.3.1节的描述,由types中的定义(element或complexType,simpleType)决定此处的类型。


Although the base WSDL structure supports bindings for these four transmission primitives,WSDL only defines bindings for the One-way and Request-response primitives. It is expected that specifications that define the protocols for Solicit-response or Notification would also include WSDL binding extensions that allow use of these primitives.


<operation name="GetLastTradePrice" parameterOrder="tickerSymbol timePeriod frequency">把input和output的所有参数都列出来,如parameterOrder


<definitions .... >

    <binding .... >

        <soap:binding transport="uri"? style="rpc|document"?>

        <operation .... >

           <soap:operation soapAction="uri"? style="rpc|document"?>?

        </operation>

    </binding>

</definitions>

The URI value http://schemas.xmlsoap.org/soap/http corresponds to the HTTP binding in the SOAP specification. Other URIs may be used here to indicate other transports (such as SMTP, FTP, etc.).


The style attribute indicates whether the operation is RPC-oriented (messages containing parameters and return values) or document-oriented (message containing document(s)). 

The soapAction attribute. For the HTTP protocol binding of SOAP, this is value required (it has no default value). For other SOAP protocol bindings, it MUST NOT be specified, and the soap:operation element MAY be omitted. 缺省为document。

如<soap:operation soapAction="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-120/getNotificationProfile"/>


四、样例:

http://www.3gpp.org/ftp/Specs/archive/32_series/

http://www.3gpp.org/ftp/Specs/archive/32_series/32.317/schema/

3GPP TS 32.615 Configuration Management (CM); Bulk CM Integration Reference Point (IRP): eXtensible Markup Language (XML) file format definition

3GPP TS 32.607 Configuration Management (CM); Basic CM Integration Reference Point (IRP); SOAP Solution Set (SS)


原创粉丝点击