Chinaunix首页 | 论坛 | 博客
  • 博客访问: 26268329
  • 博文数量: 2065
  • 博客积分: 10377
  • 博客等级: 上将
  • 技术积分: 21525
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-04 17:50
文章分类

全部博文(2065)

文章存档

2012年(2)

2011年(19)

2010年(1160)

2009年(969)

2008年(153)

分类: 系统运维

2009-11-13 17:55:51

教程!

学习将这篇文章看完基本上对WSDL有一个比较好的了解了。然后就是多编写WEB服务!

2. Service Definition

   There is a definitions element at the root, and definitions inside
[表示:有一个根元素定义  内部代码:


*

?

?
?
*
<-- extensibility element --> *


*
?
*


*
?
*
?
?
?

?
?

*
?




*
?
<-- extensibility element --> *
*
?
<-- extensibility element --> *
?
?
<-- extensibility element -->

?
?
<-- extensibility element --> *

*
?
<-- extensibility element --> *




*
?
*
?
<-- extensibility element -->

<-- extensibility element -->


<-- extensibility element --> *



基本的结构就是上面的那样子!

Services are defined using six major elements:[主要有六个主要元素实现定义的!]
  • types, which provides data type definitions used to describe the messages exchanged.[WSDL的数据类型定义]
  • 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.[绑定的地址]
  • service, which is used to aggregate a set of related ports.

2.1.1 Document Naming and Linking



*

这样做的好处解决了命名空间与文档定义的联系!

The use of the import element allows the separation of the different elements of a service
definition
into independent documents, which can then be imported as needed

data type definitions, abstract definitions, and specific service bindings
(将其三部分进行了分离说明!)

我们能够将各个部分进行独立开来分别作处理!

(如何通过servlets封装输出一段WSDL服务接口出来?)
我们能够将数据定义与方法定义接口定义等相关的进行分开定义然后直接import进来!

2.2 Types

 这个元素的定义是:data type definitions that are relevant for the exchanged messages
定义了要交换数据的数据类型定义。


格式:


*



2.3 Messages

element. Refers to an XSD element using a QName.
type
. Refers to an XSD simpleType or complexType using a QName.
示例:

*
element="qname"? type="qname"?/> *



The message name attribute provides a unique name among all messages defined within the enclosing WSDL document.

The part name attribute provides a unique name among all the parts of the enclosing message.

(元素标签的属性含义!name起到标识作用!)

Parts are a flexible mechanism for describing the logical(是一个非常灵活地描述一个消息机制的!)





如果这个消息的part过多的话就要考虑这样来实现的!
















abstract content of a message
将两个的情况综合到一块去。这样方便!

A message binding describes how the abstract content is mapped into a concrete format.
消息绑定:将一个抽象的消息进行了实体的映射处理!映射到了一个消息格式去!

2.4

 A port type is a named set of abstract operations and the 
abstract messages involved.
抽象操作的集合。全部的消息进行关联的东西!


*



WSDL has four transmission primitives that an endpoint can support:

  • One-way. The endpoint receives a message.
  • Request-response. The endpoint receives a message, and sends a correlated message.
  • Solicit-response. The endpoint sends a message, and receives a correlated message.
  • Notification. The endpoint sends a message.

2.4.1


  *





即只有一个input标签元素!

2.4.2


*



*



表示的是有输入也有输出标签!

2.4.3


*



*




2.4.4


     *







  • The part name order reflects the order of the parameters in the RPC signature
  • The return value part is not present in the list
  • If a part name appears in both the input and output message, it is an in/out parameter
  • If a part name appears in only the input message, it is an in parameter
  • If a part name appears in only the output message, it is an out parameter
规范化其命名!


2.5 Bindings



*
<-- extensibility element (1) --> *
*
<-- extensibility element (2) --> *
?
<-- extensibility element (3) -->

?
<-- extensibility element (4) --> *

*
<-- extensibility element (5) --> *





2.6

 

*
*
<-- extensibility element (1) -->




A port defines an individual endpoint by specifying a single
address for a binding.
绑定的地址值!


2.7

 

A service groups a set of related ports together:

* *
服务包含了port在一块。即发现是一层包含一层的!


3. SOAP Binding

以下整理一下SOAP是如何应用到WSDL文件里面去的!

3.








3.4 soap:operation

The soap:operation element provides information for the operation as a whole.

?

3.5 soap:body







encodingStyle="uri-list"? namespace="uri"?>



encodingStyle="uri-list"? namespace="uri"?>




3.6




*
encodingStyle="uri-list"? namespace="uri"?>




3.






encodingStyle="uri-list"? namespace="uri"?>*

encodingStyle="uri-list"? namespace="uri"?/>*




encodingStyle="uri-list"? namespace="uri"?>*

encodingStyle="uri-list"? namespace="uri"?/>*





3.8 soap:address









以 上是介绍了SOAP与WSDL的关系。下面是讲了一下HTTP与WSDL关系!

4. HTTP GET & POST Binding


  • An indication that a binding uses HTTP GET or POST
  • An address for the port
  • A relative address for each operation (relative to the base address defined by the port)
即表示:服务端与客户端的语言平台可能不一致的情况!

相关的标签如下:

4.3 http:address

4.






4.

The location attribute specifies a relative URI for the operation. This URI is combined with the URI specified in the http:address element to form the full URI for the HTTP request. The URI value MUST be a relative URI.



4.

The urlEncoded element indicates that all the message parts are encoded into the HTTP request URI using the standard URI-encoding rules (name1=value&name2=value…). The names of the parameters correspond to the names of the message parts. Each value contributed by the part is encoded using a name=value pair. This may be used with GET to specify URL encoding, or with POST to specify a FORM-POST. For GET, the "?" character is automatically appended as necessary.



The http:urlReplacement element indicates that all the message parts are encoded into the HTTP request URI using a replacement algorithm:

5. MIME Binding

WSDL includes a way to bind abstract types to concrete messages in some MIME format. Bindings for the following MIME types are defined:

  • multipart/related
  • text/xml
  • application/x-www-form-urlencoded (the format used to submit a form in HTML)
  • Others (by specifying the MIME type string)





手册帮助说明:


Extensibility elements can appear at the following locations in a WSDL document:

Location Meaning Possible usage
definitions The extensibility element applies to the WSDL document as a whole. · Introduce additional information or definitions to a WSDL document as a whole.
definitions/types The extensibility element is a type system. · Specify the format of the message in a type system other than XSD.
definitions/service The extensibility element applies to the service. · Introduce additional information or definitions for the service.
definitions/service/port The extensibility element applies to the port. · Specify an address for the port.
definitions/binding The extensibility element applies to the binding as a whole. · Provide protocol specific information that applies to all the operations in the port type being bound.
definitions/binding/operation The extensibility element applies to the operation as a whole. · Provide protocol specific information that applies to both the input message and the output message.
definitions/binding/operation/input The extensibility element applies to the input message for the operation. · Provide details on how abstract message parts map into the concrete protocol and data formats of the binding.

· Provide additional protocol specific information for the input message.

definitions/binding/operation/output The extensibility element applies to the output message of the operation. · Provide details on how abstract message parts map into the concrete protocol and data formats of the binding.

· Provide additional protocol specific information for the output message.

definitions/binding/operation/fault The extensibility element applies to a fault message of the operation. · Provide details on how abstract message parts map into the concrete protocol and data formats of the binding.

· Provide additional protocol specific information for the fault message.


示例代码:

        xmlns:wsdl=""
targetNamespace=""
elementFormDefault="qualified">
















This type is extended by component types
to allow attributes from other namespaces to be added.













































to support extensibility elements


























































































































































































<attribute name="arrayType" type="string"/>

        xmlns:soap="soap/"
targetNamespace="soap/">






























































        xmlns:http="http/"
targetNamespace="http/">





















         xmlns:mime="mime/"
xmlns="">


































阅读(1051) | 评论(3) | 转发(0) |
0

上一篇:WSDL学习心得一

下一篇:JSON学习整理一

给主人留下些什么吧!~~

chinaunix网友2009-11-16 17:21:35

PHP版的开发SOAP篇 http://hi.baidu.com/sungoogle/blog/category/soap%D1%A7%CF%B0%C8%D5%D6%BE

chinaunix网友2009-11-16 16:39:09

类型–使用某种的类型系统(比如XSD)定义数据类型的容器 消息–通讯数据抽象的有类型的定义 操作– 服务支持的动作的抽象描述 端口类型–一个操作的抽象集合,该操作由一个或多个端点支持 绑定– 针对一个特定端口类型的具体的协议规范和数据格式规范 端口– 一个单一的端点,定义成一个绑定和一个网络地址的联接 服务– 相关的端点的集合 我们可以注意到WSDL并没有引入一种新的类型语言,这一点非常重要。为了描述消息的结构,需要具有丰富类型的系统,WSDL意识到了这种需求,因此它支持XML的schema规范作为它的规范的类型系统。但是仅使用一种类型语言来描述现在和将来的所有消息格式显然是不可能的,因此WSDL可以扩展使用其他的类型定义语言。

chinaunix网友2009-11-16 16:27:32

这篇文章的原文是: http://www.w3.org/TR/wsdl