- 浏览: 156123 次
- 性别:
- 来自: 奥克兰
文章分类
最新评论
-
u012625419:
...
CXF之用spring配置服务端和客户端实例(转) -
bambooshangye:
CXF之用spring配置服务端和客户端实例(转) -
最佳蜗牛:
写的很好,谢谢!
tomcat下的server.xml文件和context.xml (转) -
mohaowen1989:
亲 有中文版的么?在grails基础上的spring-secu ...
Simplified Spring Security with Grails(转) -
douhongyang:
挺好,,思路很清晰,
spring security详解教程 (转)
转自 http://www.blogjava.net/baoyaer/articles/116413.html
WSDL文档可以分为两部分。顶部分由抽象定义组成
,而底部分则由具体描述组成。抽象部分以独立于平台和语言的方式定义SOAP消息,它们并不包含任何随机器或语言而变的元素。这就定义了一系列服务,截然不同的网站都可以实现。随网站而异的东西如序列化便归入底部分,因为它包含具体的定义。
l 抽象定义
Types - 独立与机器和语言的类型定义
Messages - 包括函数参数(输入与输出分开)或文档描述
PortTypes - 引用消息部分中消息定义来描述函数签名(操作名、输入参数、输出参数)
2 具体定义
Bindings
PortTypes - 部分的每一操作在此绑定实现 (one-way|reuqest-response|solicit-response|notification)
Services - 确定每一绑定的端口地址
<definitions> <types> ... </types> <message> ... </message> <portType> ... </portType> <binding> ... </binding> <service> ... </serivce> </definitions>
下面的图中,箭头连接符代表文档不同栏
之间的关系。点和箭头代表了引用或使用关系。双箭头代表"修改"关系。3-D的箭头代表了包含关系。这样,各Messages栏使用Types栏的定
义,PortTypes栏使用Messages栏的定义;Bindings栏引用了PortTypes栏,Services栏引用Bindings
栏,PortTypes和Bindings栏包含了operation元素,而Services栏包含了port元素。PortTypes栏里的
operation元素由Bindings栏里的operation元素进一步修改或描述。
首先看看一段简单的JAVA代码,我们用它作为WSDL的服务实现代码:
public class Test{ public String echo(String u){ return "Hello " + u; } }
看看它导出的文件:
第一行申明该文档是XML。尽管这并不是必需的,但它有助于XML解析器决定是否解析 WSDL文件或只是报错。第二行是WSDL文档的根元素:<definitions>。一些属性附属于根元素,就 像<schema>子元素对于<types>元素。
<?xml version="1.0" encoding="UTF-8" ?> <wsdl:definitions targetNamespace="http://localhost/axis/Test2.jws" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:intf="http://localhost/axis/Test2.jws" xmlns:impl="http://localhost/axis/Test2.jws"> <!-- WSDL created by Apache Axis version: 1.4 Built on Apr 22, 2006 (06:55:48 PDT) -->
定义好操作(或方法)以后,现在需要指定将向它们发送和从它们返回的参数。在 WSDL 术语中,所有参数称为“消息”。认为您是在递送消息而结果得到返回的消息是有用的。方法调用是这样一种操作:它准备返回“消息”来响应进入的消息。
<message>元素包含了Messages栏。如果我们把操作看作函数,<message>元素定义了那个
函数的参数。<message>元素中的每个<part>子元素都和某个参数相符。输入参数在<message>元
素中定义,与输出参数相隔离--输出参数有自己的<message>元素。兼作输入、输出的参数在输入输出的<message>
元素中有它们相应的<part>元素。输出<message>元素以"Response"结尾,就像以前所用
的"fooResponse"。每个<part>元素都有名字和类型属性,就像函数的参数有参数名和参数类型。
<wsdl:message name="echoResponse"> //返回的消息 <wsdl:part name="echoReturn" type="xsd:string" /> </wsdl:message> <wsdl:message name="echoRequest"> //请求的消息 <wsdl:part name="u" type="xsd:string" /> </wsdl:message>
<definitions>
元素包含一个或多个 <portType>
元素,实际上,每个元素都是您希望表示的一系列 operation
。或者,您也可以将单个 portType
元素看作是将各种方法组成类的一个逻辑分组。例如,如果您的供应链管理解决方案需要在客户和供应商之间进行交互,您最可能做的是分别定义与他们交互的功能
性;也就是说,您将为用户和供应商各定义一个 portType。应该将每个 portType 称为 服务
,因此整个 WSDL 文件将成为一个服务集合。
<wsdl:portType name="Test2"> //一个portType可以看成一个类 <wsdl:operation name="echo" parameterOrder="u"> //一个operation就是一个方法 <wsdl:input name="echoRequest" message="impl:echoRequest" /> //输入消息 <wsdl:output name="echoResponse" message="impl:echoResponse" /> //返回消息 </wsdl:operation> </wsdl:portTyp>
消息传递和传输:
我以一种抽象方式定义了操作和消息,而不考虑实现的细节。实际上,WSDL 的任务是定义或描述 Web 服务,然后提供一个对外部框架的引用来定义 WSDL 用户将如何实现这些服务。可以将这个框架当作 WSDL 抽象定义和它们的实现之间的“绑定( binding
)”。
当前,最流行的绑定( binding
)技术是使用简单对象访问协议
(SOAP)。WSDL 将指定能够访问 Web 服务实际实现的 SOAP 服务器,并且从那时起 SOAP 的整个任务就是将用户从 WSDL 文件带到它的实现
。
WSDL 编写的第三个步骤是描述将 SOAP 与 WSDL 文件绑定到一起的过程
您将把 <binding>
元素包括到 <definitions>
元素内。这个 binding 元素应该有 name
和 type
属性。 name
将标识这个绑定而 type
将标识您希望与这个绑定相关联的 portType(一组操作)。
<wsdl:binding name="Test2SoapBinding" type="impl:Test2">...</wsdl:binding>
<wsdlsoap:binding> 元素。该元素的用途是声明将把 SOAP 作为绑定和传输服务使用
<wsdlsoap:binding>
元素有两个属性:style 和
transport
。style 是一个可选属性(rpc|document),它描述该绑定内操作的性质。transport 属性指定 HTTP
作为该绑定将使用的级别较低的传输服务。SOAP 客户机将从 WSDL 文件中读取 SOAP 结构并与另一端的 SOAP 服务器协调.
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
WSDL <operation>
元素,分别表示具体的操作。每个 <operation>
元素提供各自操作的绑定细节。因此,我提供了另一个 extensibility
元素,即 <wsdlsoap:operation/>
(仍然是一个空元素,与它发生的那个操作相关)。该 <soap:operation/>
元素有一个 soapAction 属性,SOAP 客户机将使用该属性创建 SOAP 请求。
//下面将WSDL描述与具体实现进行绑定,这里采用SOAP方式 <wsdl:binding name="Test2SoapBinding" type="impl:Test2"> <wsdl:operation name="echo"> <wsdlsoap:operation soapAction="" /> <wsdl:input name="echoRequest"> <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" /> </wsdl:input> <wsdl:output name="echoResponse"> <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/axis/Test2.jws" /> </wsdl:output> </wsdl:operation> </wsdl:binding>
//下面将发布的服务与前面的SOAP绑定进行关联 <wsdl:service name="Test2Service"> <wsdl:port name="Test2" binding="impl:Test2SoapBinding"> <wsdlsoap:address location="http://localhost/axis/Test2.jws" /> </wsdl:port> </wsdl:service>
每个namespace属性都声明了一个缩略语,用在文档中。例如"xmlns:xsd"就为
http://www.w3.org/2001/XMLSchema定义了一个缩略语(xsd)。这就允许对该namespace的引用只需简单的在名字
前加上前缀就可以了,如:"xsd:int"中的"xsd"就是合法的类型名。普通范围规则可运用于缩略前缀。也就是说,前缀所定义的元素只在元素中有
效。
Namespace派什么用?namespace的作用是要避免命名冲突。如果我建立一项Web
Service,其中的WSDL文件包含一个名为"foo"的元素,而你想要使用我的服务与另一项服务连接作为补充,这样的话另一项服务的WSDL文件就
不能包含名为"foo"的元素。两个服务器程序只有在它们在两个事例中表示完全相同的东西时,才可以取相同的名字。如果有了表示区别的
namespace,我的网络服务里的"foo"就可以表示完全不同于另一个网络服务里"foo"的含义。在你的客户端里,你只要加以限制就可以引用我
的"foo"。
见下例:http://www.infotects.com/fooService#foo
就是完全限制的名字,相当于"carlos:foo",如果我声明了carlos作为http://www.infotects.com
/fooService的快捷方式。请注意namespace中的URL是用来确定它们的唯一性的,同时也便于定位。URL所指向的地方不必是实际存在的
网络地址,也可以使用GUID来代替或补充URL。例如,GUID"335DB901-D44A-11D4-A96E-0080AD76435D"就是一
个合法的namespace指派。
targetNamespace属性声明了一个namespace,元素中所有的声明的名字都列于其内。在WSDL示例中,<definitions>的targetNamespace 是http://tempuri.org/wsdl
。这意味着所有在WSDL文档中声明的名字都属于这个namespace。<schema>元素有自己的targetNamespace属性,其值为 http://tempuri.org/xsd
,在<schma>元素中定义的所有名字都属于这个namespace而不是main的target namespace。
<schema>元素的以下这行声明了默认的namespace。Schema中所有有效的名字都属于这个namespace。
附一个比较完整的例子,以供参考学习:
SOAP request
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <m:GetEndorsingBoarder xmlns:m="http://namespaces.snowboard-info.com"> <manufacturer>K2</manufacturer> <model>Fatbob</model> </m:GetEndorsingBoarder> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
SOAP response
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <m:GetEndorsingBoarderResponse xmlns:m="http://namespaces.snowboard-info.com"> <endorsingBoarder>Chris Englesmann</endorsingBoarder> </m:GetEndorsingBoarderResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
WSDL description
<?xml version="1.0"?> <!-- root element wsdl:definitions defines set of related services --> <wsdl:definitions name="EndorsementSearch" targetNamespace="http://namespaces.snowboard-info.com" xmlns:es="http://www.snowboard-info.com/EndorsementSearch.wsdl" xmlns:esxsd="http://schemas.snowboard-info.com/EndorsementSearch.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <!-- wsdl:types encapsulates schema definitions of communication types; here using xsd --> <wsdl:types> <!-- all type declarations are in a chunk of xsd --> <xsd:schema targetNamespace="http://namespaces.snowboard-info.com" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <!-- xsd definition: GetEndorsingBoarder [manufacturer string, model string] --> <xsd:element name="GetEndorsingBoarder"> <xsd:complexType> <xsd:sequence> <xsd:element name="manufacturer" type="string"/> <xsd:element name="model" type="string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <!-- xsd definition: GetEndorsingBoarderResponse [... endorsingBoarder string ...] --> <xsd:element name="GetEndorsingBoarderResponse"> <xsd:complexType> <xsd:all> <xsd:element name="endorsingBoarder" type="string"/> </xsd:all> </xsd:complexType> </xsd:element> <!-- xsd definition: GetEndorsingBoarderFault [... errorMessage string ...] --> <xsd:element name="GetEndorsingBoarderFault"> <xsd:complexType> <xsd:all> <xsd:element name="errorMessage" type="string"/> </xsd:all> </xsd:complexType> </xsd:element> </xsd:schema> </wsdl:types> <!-- wsdl:message elements describe potential transactions --> <!-- request GetEndorsingBoarderRequest is of type GetEndorsingBoarder --> <wsdl:message name="GetEndorsingBoarderRequest"> <wsdl:part name="body" element="esxsd:GetEndorsingBoarder"/> </wsdl:message> <!-- response GetEndorsingBoarderResponse is of type GetEndorsingBoarderResponse --> <wsdl:message name="GetEndorsingBoarderResponse"> <wsdl:part name="body" element="esxsd:GetEndorsingBoarderResponse"/> </wsdl:message> <!-- wsdl:portType describes messages in an operation --> <wsdl:portType name="GetEndorsingBoarderPortType"> <!-- the value of wsdl:operation eludes me --> <wsdl:operation name="GetEndorsingBoarder"> <wsdl:input message="es:GetEndorsingBoarderRequest"/> <wsdl:output message="es:GetEndorsingBoarderResponse"/> <wsdl:fault message="es:GetEndorsingBoarderFault"/> </wsdl:operation> </wsdl:portType> <!-- wsdl:binding states a serialization protocol for this service --> <wsdl:binding name="EndorsementSearchSoapBinding" type="es:GetEndorsingBoarderPortType"> <!-- leverage off soap:binding document style @@@(no wsdl:foo pointing at the soap binding) --> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <!-- semi-opaque container of network transport details classed by soap:binding above @@@ --> <wsdl:operation name="GetEndorsingBoarder"> <!-- again bind to SOAP? @@@ --> <!-- if <wsdl:operation name="EndorsementSearch"> exists, then, soapAction seems can be ingored --> <soap:operation soapAction="http://www.snowboard-info.com/EndorsementSearch"/> <!-- furthur specify that the messages in the wsdl:operation "GetEndorsingBoarder" use SOAP? @@@ --> <wsdl:input> <soap:body use="literal" namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/> </wsdl:input> <wsdl:output> <soap:body use="literal" namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/> </wsdl:output> <wsdl:fault> <soap:body use="literal" namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/> </wsdl:fault> </wsdl:operation> </wsdl:binding> <!-- wsdl:service names a new service "EndorsementSearchService" --> <wsdl:service name="EndorsementSearchService"> <wsdl:documentation>snowboarding-info.com Endorsement Service</wsdl:documentation> <!-- connect it to the binding "EndorsementSearchSoapBinding" above --> <wsdl:port name="GetEndorsingBoarderPort" binding="es:EndorsementSearchSoapBinding"> <!-- give the binding an network address --> <soap:address location="http://www.snowboard-info.com/EndorsementSearch"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
评论
:) 不好意思,我没明白你的问题,如果是定义wsdl的话,
wsdl:types
wsdl:message
wsdl:portType
wsdl:binding
wsdl:service
这几个都基本上是必须的
发表评论
-
Difference between RPC/Document, literal/encoded
2011-12-01 16:39 2292转自 http://www.ibm.com/dev ... -
Java web services: WS-Security with CXF (转)
2011-09-05 17:45 2150This article is refered from h ... -
CXF全接触 --- WS-Security的实现 (转)
2011-09-05 17:36 2274转自 http://blog.csdn.net/kuns ... -
SSL原理解密(转)
2011-07-26 06:47 1526RSA公钥加密在计算机产 ... -
UsernameToken 介绍(转)
2011-04-14 12:39 1734很好的一篇文章,转过 ... -
不同格式证书导入keystore方法(转)
2011-04-14 12:24 2451转自: http://hi.baidu.com/%D3%C ... -
CXF使用WSS4J实现WS-Security规范之使用用户名令牌(转)
2011-04-14 10:35 2143转自 http://blog.csdn.net/fhd001/ ... -
深入浅出WS-Addressing(转)
2010-10-28 11:51 12141. 为什么需要 WS-Addressin ... -
WS-Addressing EndpointReference(转)
2010-10-28 11:18 1007WS-Addressing规范主要描述 ... -
WS-Addressing 问题的引出(转)
2010-10-28 11:15 792SOAP 协议定义了在 Web Services 之间传 ... -
WS-Addressing Message Addressing Properties (转)
2010-10-28 11:09 1767相对EndpointReference而言,个人认为在WS-A ... -
SOAP与CORBA,COM/DCOM的区别(转)
2010-09-23 17:49 1706CORBA(Common Object Request Br ... -
Java Web 服务: Axis2 中的 JAXB 和 JAX-WS(转)
2010-09-23 17:41 1263Apache Axis2 支持各种数据 ... -
Web Service简介 (转)
2010-09-23 17:25 6871.定义 由两部分组成 ... -
WSDL & SOAP & Web Service (转)
2010-09-23 17:24 902WSDL 是基于 XML 的用于描述 Web Services ...
相关推荐
NULL 博文链接:https://mljavalife.iteye.com/blog/1205564
如何用.net调用java或net写的webservice(遵循wsdl规则
wsdl2java源码笔记 由于 WSO2 BRS 功能在 WSO2 Integrator() 中可用作为规则中介,我们正在弃用此产品并将其移至阁楼。 WSO2 业务规则服务器 2.2.0 分支 构建状态 掌握 欢迎使用 WSO2 BRS 2.2.0 版本 WSO2 BRS 是一...
它基于 XML 协议,包括四个部分:SOAP 封装、SOAP 编码规则、SOAP RPC 表示和 SOAP 绑定。SOAP 采用 HTTP 和 XML 两个协议,用于实现 RPC 风格的传输和编码模式。 在 SOAP 中,SOAP 消息是指使用 XML 编码的消息体...
WSDL-DSL WSDL-DSL是一种特定于域的语言,它重用了WSDL语法的基本部分,从而很容易将WSDL类型表示为QuickCheck生成器。 依存关系 为了使用wsdl_dsl您需要许可证。 编译中 编译过程委托,但它包装在Makefile中。 您...
什么是 WSDL? 8 什么是UDDI? 8 Web Service 实例 9 一个实例:ASP.NET Web Service 9 要运行这个例子,我们需要一个 .NET 服务器 10 ASP.NET 的自动化处理 11 Web Service 使用 11 使用我们的 ASP.NET Web Service ...
wsdlInmporter 导入你这个网站的Wsdl 让程序知道调用规则 不出意外会生成个WeatherWebService.pas ,主窗体引用它 3.设置HTTPRIO的 port, service, wsdlLocation 会下拉出来 4.写点代码吧 //得到支持的地区 ...
什么是WebServices?...因为WSDL文件中已经给定了web service的地址URI,外部可以直接通过WSDL提供的URI进行相应的web service调用。所以UDDI并不是一个必需的web service组件,服务方完全可以不进行UDDI的注册。
wsdl2java源码解析使用 SOA 架构开发和设计有助于改善您的在线购物体验的服务。 抽象的 很难找到比商业更受互联网流行影响的市场。 从您当地的夫妻店到零售巨头,在线购物在说服购物者从实体店购买商品,甚至在线...
SCA通用注解、API、客户程序及实现模型为《SCA装配模型规范》[1]中定义的编程理念制定了Java语法规则。它规定了一套“java-based”SCA规范使用的API与注解。 具体的此规范包括如下内容: 1、构件服务、引用以及属性...
C#面试要点 ...什么是Web Service(SOAP、UDDI、WSDL)? 6.WebService有哪些关键技术和规则? 7.ASP.NET的缓冲机制是什么? 8.应用程序缓存是怎样实现的? 9..net 三层架构是哪三层,代表什么意思?
目 录 摘 要 I ...附录A XML数据类型和Java数据类型之间的映射规则 57 附录B 功能层XML schema的设计 58 附录C 表示层XML schema的设计 60 附录D 传输层XML schema的设计 61 附录E TXT文本的格式介绍 63
新兴的云计算引入了用于开发企业学术Web应用程序的新... 我们使用了三个案例研究来测试我们的情绪,然后我们应用JSON解析器来感知Web服务描述文件(WSDL文件),并根据数据通过我们的解析来允许或拒绝数据的供应策略。
很多不太懂正则的朋友,在遇到需要用正则校验数据时,往往是在网上去找很久,结果找来的还是不很符合要求。所以我最近把开发中常用的一些正则表达式整理了一下,在这里分享一下。给自己留个底,也给朋友们做个参考。
5. ezService使用名为ESDL(ezService定义语言)的(类似WSDL)XML发布文档,ESDL可以对外界发布ezService所开发服务的全部功能接口,使得第三方开发者也可以方便的了解服务,快速进行二次开发而无需了解服务细节。...
在服务单元级别,WSDL接口信息用于构造决策表。 在服务组合级别上,决策信息系统是通过综合使用流程规范和接口信息来构建的。 然后,采用粗糙集推理中的规则挖掘算法来揭示与服务或系统故障相关的输入情况。 还讨论...
模式分析器一组用于分析模式(xsd 和 wsdl)并根据一组合规性规则报告错误和警告的工具。类路径将 lib/mxquery.jar 添加到类路径lib文件夹内容轻量级、功能齐全的 XQuery 引擎wsi-checker*.jar:用于 WS-I 基本配置...
-t 定义std:string到C++中的字符串转化规则, 当前例子采用UNIOCDE编码编译,请在wsmap.dat 中加上 xsd__string = | std::wstring | std::wstring* 这句话 -o 文件名,指定输出头文件 -n 名空间前缀 代替默认的ns ...
wsdl肥皂架 json ld ocaml语言 Qubes-os Pop-os 背包算法 打字稿GraphQL TypeGraphQL TypeORM PostgreSQL React Appollo NuxtJs tailwindcss 图论语法自然语言状态机算法在有限时间或全np中确定性 多租户基础代码...