WSDL 1.1 与WSDL 2.0

12 篇文章 0 订阅

参考:

wsdl 2.0 的参考博客--- http://tutorials.jenkov.com/wsdl/index.html


WSDL----

Web Service Description Language,用于描述web service的接口
--基于xml的用于描述web services以及如何访问web services的语言


Xml相关的概念

WSDL-->Web Service Description Language,用于描述web service的接口
概念--基于xml的用于描述web services以及如何访问web services的语言
				    XML文档形成一种树结构,它从根部开始,然后扩展到枝叶,用于传输和处理数据
				( XML声明  <?xml  version="1.0" encoding="utf-8" ?>) 
						    元素、属性(提供元素的额外信息)、内容  
						   XML元素必须有根元素、必须正确的嵌套、必须有关闭标签、元素名对大小写敏感、
						属性值必须加引号(单引号和双引号均可)
					         实体引用(拥有特殊意义的字符) < &lt; & &amp; > &gt; " &quot; ' &apos;
					         XML注释 <!-- --> 空格会保留
	XML验证--形式良好的XML--没有语法错误的XML
			合法的XML--经过XML DTD/XML Schema验证的形式良好的XML
	XML命名空间--提供避免元素命名冲突的方法  
				默认  xmlns="namespaceUri"----相当于java中默认的java.lang包,
				标签中不带前缀的元素,默认都是引用此包
				拥有前缀 xmlns:前缀="namespaceUri"----相当于java中使用import导入的包
		targetNamespace----相当于 java文件中最开始头文件中的package
		       它代表在这个元素及其子元素下定义的任何元素、数据类型等都会被定义在指定的名字空间上
							 CDATA--unparsed character data /会被xml解析器忽略  <![CDATA[  ]]>
					    PCDATA--PARSED CHARACTER DATA/被解析的字符数据
	XML Schema-->定义XML文档的合法构建模块,替代DTD(文档类型定义)
				      <!DOCTYPE note SYSTEM "http://www.w3school.com.cn/dtd/note.dtd">
				      xsi:schemaLocation=<a target=_blank href="http://www.w3school.com.cn note.xsd">http://www.w3school.com.cn note.xsd</a>



WSDL 1.1中相关概念

WSDL 1.1中相关概念--
   服务(service)绑定(binding)端口类型(portType)(操作(operation)中包含消息(message) 消息中包含元素
(element 元素都有名称和类型)与类型(types) )
                   portType--->函数库   message-->参数  types-->数据类型   binding-->定义函数库的消息格式和协议细节

wsdl 示例



WSDL 2.0 相关概念

       WSDL相关元素描述----


WSDL的XML大致结构----


WSDL元素与JAVA接口对比



各个元素的解释:

Description元素----
		The WSDL description element is the root element of a WSDL 2.0 file.
  
		<?xml version="1.0" encoding="utf-8" ?>
		<description
		    xmlns=           "http://www.w3.org/ns/wsdl"
		    targetNamespace= "http://jenkov.com/MyService"
		    xmlns:tns=       "http://jenkov.com/MyService"
		    xmlns:stns =     "http://jenkov.com/MyService/schema"
		    xmlns:wsoap=     "http://www.w3.org/ns/wsdl/soap"
		    xmlns:soap=      "http://www.w3.org/2003/05/soap-envelope"
		    xmlns:wsdlx=     "http://www.w3.org/ns/wsdl-extensions" >
		
		</description>
		
		xmlns----默认的命名空间,用用XML中的所有元素
		targetNamespace----目标命名空间,可以随意设定,但通常设置为web services的URI
		xmlns:tns----与目标命名空间一致
		xmlns:stns--目标命名空间的模式地址,此地址指向xml schema的命名空间,通常是types元素中定义的
		   schema的xmlns的值
		xmlns:wsoap----指向wsdl soap的地址
		xmlns:soap----指向soap的地址
		xmlns:wsdlx----指向wsdl-extensions的地址

Types----
          The WSDL types element describes the data types used by your web service
		<types>
		
		    <xs:schema
		        xmlns:xs=        "http://www.w3.org/2001/XMLSchema"
		        targetNamespace= "http://jenkov.com/MyService/schema"
		        xmlns:tns=       "http://jenkov.com/MyService/schema"
		    >
		
		        <xs:element name="latestTutorialRequest"
		                       type="typeLatestTutorialRequest"/>
		
		        <xs:complexType name="typeLatestTutorialRequest">
		          <xs:sequence>
		            <xs:element  name="date"   type="xs:date"/>
		          </xs:sequence>
		        </xs:complexType>
		
		        <xs:element name="latestTutorialResponse" type="xs:string"/>
		
		        <xs:element name="invalidDateError" type="xs:string"/>
		
		    </xs:schema>
		
		  </types>
	only elements declared as single elements (there can be only one), 
	and as top level elements (not nested inside other elements), 
	can be referred to by the WSDL 2.0 interface and operation elements


Interface----
		The WSDL interface element describes the operations supported by your web service.
					<interface  name = "latestTutorialInterface" >
					
					  <fault name = "invalidDateFault"  element = "stns:invalidDateError"/>
					
					  <operation name="latestTutorialOperation"
					          pattern="http://www.w3.org/ns/wsdl/in-out"
					          style="http://www.w3.org/ns/wsdl/style/iri"
					          wsdlx:safe = "true">
					
					    <input    messageLabel="In"  element="stns:latestTutorialRequest" />
					    <output   messageLabel="Out" element="stns:latestTutorialResponse" />
					    <outfault messageLabel="Out" ref    ="tns:invalidDateFault" />
					
					  </operation>
					
					</interface>
		The wsdlx:safe attribute indicates that this operation is safe to call, 
			meaning the customer does not agree to buy anything, or order anything
		The name attribute of the operation element defines the name for the operation. 
			This name must be unique within the interface element. The operation name is used later, 
			when describing bindings for the operation.

Binding----
		The WSDL binding element describes how your web service is bound to a protocol.
		The binding name is referenced by the service element.
				<binding name="latestTutorialSOAPBinding"
				        interface="tns:latestTutorialInterface"
				        type="http://www.w3.org/ns/wsdl/soap"
				        wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/">
				
				  <fault ref="tns:invalidDateFault" wsoap:code="soap:Sender"/>
				
				  <operation ref="tns:latestTutorialOperation"
				    wsoap:mep="http://www.w3.org/2003/05/soap/mep/soap-response"/>
				
				</binding>
		The type attribute tells what kind of message format the interface is bound to. 
			The value in the example states that the message format is SOAP. 
		The wsoap:protocol attribute specifies a SOAP binding - in other words, 
			how the SOAP messages are transported. The value in the example specifies HTTP. 
		The wsoap:mep attribute of the operation element, specifies a Message Exchange Pattern (MEP),
		 which is a SOAP thing.
		 See the the WSDL spec for more detail on this attribute. 

Service----
		The WSDL service element describes the endpoint of your web service. 
			In other words, the address where the web service can be reached. 
				<service
				     name     ="latestTutorialService"
				     interface="tns:latestTutorialInterface">
				
				   <endpoint name ="latestTutorialEndpoint"
				          binding ="tns:latestTutorialSOAPBinding"
				          address ="http://jenkov.com/latestTutorial"/>
				
				</service>
		The endpoint element describes the address of the web service. 
			The endpoint binding attribute describes what binding element this endpoint uses.
			 In other words, the protocol via which you can access the service. 
			The address attribute describes the URI at which you can access the service.


我查了一下    最新的cxf3.1目前也只支持wsdl1.1 axis2的最新版也不支持wsdl2.0  先了解下 应该以后会支持的

记录学习脚步






  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值