webservice wsdl文件详解

 

 WSDL:  Web Services Description Language  网页服务描述语言

 

详解WSDL文档元素:

文件是以XML格式定义的,内容分成了5大元素:

1、<types>:webservice使用的数据类型,它是独立以机器和语言的类型定义,这些数据类型被<message>标签所使用。

2、<message>:webservice使用的消息,它定义了webservice函数的参数。在webservice中输入参数和输出参数需要分开定义,使用不同的message标签体。message定义的输入输出参数,被<portType>标签使用。

3、<portType>:webservice执行操作。该标签引用<message>标签定义的函数来描述函数的签名(操作名、输入参数、输出参数)

4、<binding>:webservice通信协议。在portType中定义的每一项操作,都在此绑定中实现。

5、<service>:该标签定义每一绑定的端口地址。

 

WSDL文档可以分为两部分。顶部分由抽象定义组成,而底部分则由具体描述组成。抽象部分以独立于平台和语言的方式定义SOAP消息,它们并不包含任何随机器或语言而变的元素。这就定义了一系列服务,截然不同的应用都可以实现。具体部分,如数据的序列化则归入底部分,因为它包含具体的定义。在上述的文档元素中,<types>、<message>、<portType>属于抽象定义层,<binding>、<service>属于具体定义层。所有的抽象可以是单独存在于别的文件中,也可以从主文档中导入。

 

 

WSDL文档一个实例:

 

Xml代码  收藏代码
  1.  <?xml version="1.0" encoding="UTF-8" ?>  
  2. lt;wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"  
  3. xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://servicelifecycle.sample"  
  4. xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"  
  5. xmlns:ax21="http://bean.servicelifecycle.sample/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"  
  6. xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"  
  7. xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://servicelifecycle.sample">  
  8. <wsdl:documentation>Library</wsdl:documentation>  
  9. <wsdl:types>  
  10.     <xs:schema xmlns:ax22="http://bean.servicelifecycle.sample/xsd"  
  11.         attributeFormDefault="qualified" elementFormDefault="qualified"  
  12.         targetNamespace="http://servicelifecycle.sample">  
  13.         <xs:import namespace="http://bean.servicelifecycle.sample/xsd" />  
  14.         <xs:element name="returnBook">  
  15.             <xs:complexType>  
  16.                 <xs:sequence>  
  17.                     <xs:element minOccurs="0" name="isbn" nillable="true"  
  18.                         type="xs:string" />  
  19.                 </xs:sequence>  
  20.             </xs:complexType>  
  21.         </xs:element>  
  22.         <xs:complexType name="Exception">  
  23.             <xs:sequence>  
  24.                 <xs:element minOccurs="0" name="Exception" nillable="true"  
  25.                     type="xs:anyType" />  
  26.             </xs:sequence>  
  27.         </xs:complexType>  
  28.         <xs:element name="register">  
  29.             <xs:complexType>  
  30.                 <xs:sequence>  
  31.                     <xs:element minOccurs="0" name="userName" nillable="true"  
  32.                         type="xs:string" />  
  33.                     <xs:element minOccurs="0" name="passWord" nillable="true"  
  34.                         type="xs:string" />  
  35.                 </xs:sequence>  
  36.             </xs:complexType>  
  37.         </xs:element>  
  38.         <xs:element name="registerResponse">  
  39.             <xs:complexType>  
  40.                 <xs:sequence>  
  41.                     <xs:element minOccurs="0" name="return" type="xs:boolean" />  
  42.                 </xs:sequence>  
  43.             </xs:complexType>  
  44.         </xs:element>  
  45.         <xs:element name="login">  
  46.             <xs:complexType>  
  47.                 <xs:sequence>  
  48.                     <xs:element minOccurs="0" name="userName" nillable="true"  
  49.                         type="xs:string" />  
  50.                     <xs:element minOccurs="0" name="passWord" nillable="true"  
  51.                         type="xs:string" />  
  52.                 </xs:sequence>  
  53.             </xs:complexType>  
  54.         </xs:element>  
  55.         <xs:element name="loginResponse">  
  56.             <xs:complexType>  
  57.                 <xs:sequence>  
  58.                     <xs:element minOccurs="0" name="return" type="xs:boolean" />  
  59.                 </xs:sequence>  
  60.             </xs:complexType>  
  61.         </xs:element>  
  62.         <xs:element name="listLendBookResponse">  
  63.             <xs:complexType>  
  64.                 <xs:sequence>  
  65.                     <xs:element maxOccurs="unbounded" minOccurs="0" name="return"  
  66.                         nillable="true" type="ax22:Book" />  
  67.                 </xs:sequence>  
  68.             </xs:complexType>  
  69.         </xs:element>  
  70.         <xs:element name="listAvailableBookResponse">  
  71.             <xs:complexType>  
  72.                 <xs:sequence>  
  73.                     <xs:element maxOccurs="unbounded" minOccurs="0" name="return"  
  74.                         nillable="true" type="ax22:Book" />  
  75.                 </xs:sequence>  
  76.             </xs:complexType>  
  77.         </xs:element>  
  78.         <xs:element name="listAllBookResponse">  
  79.             <xs:complexType>  
  80.                 <xs:sequence>  
  81.                     <xs:element maxOccurs="unbounded" minOccurs="0" name="return"  
  82.                         nillable="true" type="ax22:Book" />  
  83.                 </xs:sequence>  
  84.             </xs:complexType>  
  85.         </xs:element>  
  86.         <xs:element name="lendBook">  
  87.             <xs:complexType>  
  88.                 <xs:sequence>  
  89.                     <xs:element minOccurs="0" name="isbn" nillable="true"  
  90.                         type="xs:string" />  
  91.                     <xs:element minOccurs="0" name="userName" nillable="true"  
  92.                         type="xs:string" />  
  93.                 </xs:sequence>  
  94.             </xs:complexType>  
  95.         </xs:element>  
  96.         <xs:element name="lendBookResponse">  
  97.             <xs:complexType>  
  98.                 <xs:sequence>  
  99.                     <xs:element minOccurs="0" name="return" nillable="true"  
  100.                         type="ax22:Book" />  
  101.                 </xs:sequence>  
  102.             </xs:complexType>  
  103.         </xs:element>  
  104.     </xs:schema>  
  105.     <xs:schema attributeFormDefault="qualified"  
  106.         elementFormDefault="qualified" targetNamespace="http://bean.servicelifecycle.sample/xsd">  
  107.         <xs:complexType name="Book">  
  108.             <xs:sequence>  
  109.                 <xs:element minOccurs="0" name="author" nillable="true"  
  110.                     type="xs:string" />  
  111.                 <xs:element minOccurs="0" name="isbn" nillable="true"  
  112.                     type="xs:string" />  
  113.                 <xs:element minOccurs="0" name="title" nillable="true"  
  114.                     type="xs:string" />  
  115.             </xs:sequence>  
  116.         </xs:complexType>  
  117.     </xs:schema>  
  118. </wsdl:types>  
  119. <wsdl:message name="loginRequest">  
  120.     <wsdl:part name="parameters" element="ns:login" />  
  121. </wsdl:message>  
  122. <wsdl:message name="loginResponse">  
  123.     <wsdl:part name="parameters" element="ns:loginResponse" />  
  124. </wsdl:message>  
  125. <wsdl:message name="lendBookRequest">  
  126.     <wsdl:part name="parameters" element="ns:lendBook" />  
  127. </wsdl:message>  
  128. <wsdl:message name="lendBookResponse">  
  129.     <wsdl:part name="parameters" element="ns:lendBookResponse" />  
  130. </wsdl:message>  
  131. <wsdl:message name="listAllBookRequest" />  
  132. <wsdl:message name="listAllBookResponse">  
  133.     <wsdl:part name="parameters" element="ns:listAllBookResponse" />  
  134. </wsdl:message>  
  135. <wsdl:message name="listLendBookRequest" />  
  136. <wsdl:message name="listLendBookResponse">  
  137.     <wsdl:part name="parameters" element="ns:listLendBookResponse" />  
  138. </wsdl:message>  
  139. <wsdl:message name="returnBookRequest">  
  140.     <wsdl:part name="parameters" element="ns:returnBook" />  
  141. </wsdl:message>  
  142. <wsdl:message name="registerRequest">  
  143.     <wsdl:part name="parameters" element="ns:register" />  
  144. </wsdl:message>  
  145. <wsdl:message name="registerResponse">  
  146.     <wsdl:part name="parameters" element="ns:registerResponse" />  
  147. </wsdl:message>  
  148. <wsdl:message name="listAvailableBookRequest" />  
  149. <wsdl:message name="listAvailableBookResponse">  
  150.     <wsdl:part name="parameters" element="ns:listAvailableBookResponse" />  
  151. </wsdl:message>  
  152. <wsdl:portType name="LibraryPortType">  
  153.     <wsdl:operation name="login">  
  154.         <wsdl:input message="ns:loginRequest" wsaw:Action="urn:login" />  
  155.         <wsdl:output message="ns:loginResponse" wsaw:Action="urn:loginResponse" />  
  156.     </wsdl:operation>  
  157.     <wsdl:operation name="lendBook">  
  158.         <wsdl:input message="ns:lendBookRequest" wsaw:Action="urn:lendBook" />  
  159.         <wsdl:output message="ns:lendBookResponse" wsaw:Action="urn:lendBookResponse" />  
  160.     </wsdl:operation>  
  161.     <wsdl:operation name="listAllBook">  
  162.         <wsdl:input message="ns:listAllBookRequest" wsaw:Action="urn:listAllBook" />  
  163.         <wsdl:output message="ns:listAllBookResponse"  
  164.             wsaw:Action="urn:listAllBookResponse" />  
  165.     </wsdl:operation>  
  166.     <wsdl:operation name="listLendBook">  
  167.         <wsdl:input message="ns:listLendBookRequest" wsaw:Action="urn:listLendBook" />  
  168.         <wsdl:output message="ns:listLendBookResponse"  
  169.             wsaw:Action="urn:listLendBookResponse" />  
  170.     </wsdl:operation>  
  171.     <wsdl:operation name="returnBook">  
  172.         <wsdl:input message="ns:returnBookRequest" wsaw:Action="urn:returnBook" />  
  173.     </wsdl:operation>  
  174.     <wsdl:operation name="register">  
  175.         <wsdl:input message="ns:registerRequest" wsaw:Action="urn:register" />  
  176.         <wsdl:output message="ns:registerResponse" wsaw:Action="urn:registerResponse" />  
  177.     </wsdl:operation>  
  178.     <wsdl:operation name="listAvailableBook">  
  179.         <wsdl:input message="ns:listAvailableBookRequest"  
  180.             wsaw:Action="urn:listAvailableBook" />  
  181.         <wsdl:output message="ns:listAvailableBookResponse"  
  182.             wsaw:Action="urn:listAvailableBookResponse" />  
  183.     </wsdl:operation>  
  184. </wsdl:portType>  
  185. <wsdl:binding name="LibrarySoap11Binding" type="ns:LibraryPortType">  
  186.     <soap:binding transport="http://schemas.xmlsoap.org/soap/http"  
  187.         style="document" />  
  188.     <wsdl:operation name="login">  
  189.         <soap:operation soapAction="urn:login" style="document" />  
  190.         <wsdl:input>  
  191.             <soap:body use="literal" />  
  192.         </wsdl:input>  
  193.         <wsdl:output>  
  194.             <soap:body use="literal" />  
  195.         </wsdl:output>  
  196.     </wsdl:operation>  
  197.     <wsdl:operation name="lendBook">  
  198.         <soap:operation soapAction="urn:lendBook" style="document" />  
  199.         <wsdl:input>  
  200.             <soap:body use="literal" />  
  201.         </wsdl:input>  
  202.         <wsdl:output>  
  203.             <soap:body use="literal" />  
  204.         </wsdl:output>  
  205.     </wsdl:operation>  
  206.     <wsdl:operation name="register">  
  207.         <soap:operation soapAction="urn:register" style="document" />  
  208.         <wsdl:input>  
  209.             <soap:body use="literal" />  
  210.         </wsdl:input>  
  211.         <wsdl:output>  
  212.             <soap:body use="literal" />  
  213.         </wsdl:output>  
  214.     </wsdl:operation>  
  215.     <wsdl:operation name="listAllBook">  
  216.         <soap:operation soapAction="urn:listAllBook" style="document" />  
  217.         <wsdl:input>  
  218.             <soap:body use="literal" />  
  219.         </wsdl:input>  
  220.         <wsdl:output>  
  221.             <soap:body use="literal" />  
  222.         </wsdl:output>  
  223.     </wsdl:operation>  
  224.     <wsdl:operation name="returnBook">  
  225.         <soap:operation soapAction="urn:returnBook" style="document" />  
  226.         <wsdl:input>  
  227.             <soap:body use="literal" />  
  228.         </wsdl:input>  
  229.     </wsdl:operation>  
  230.     <wsdl:operation name="listLendBook">  
  231.         <soap:operation soapAction="urn:listLendBook" style="document" />  
  232.         <wsdl:input>  
  233.             <soap:body use="literal" />  
  234.         </wsdl:input>  
  235.         <wsdl:output>  
  236.             <soap:body use="literal" />  
  237.         </wsdl:output>  
  238.     </wsdl:operation>  
  239.     <wsdl:operation name="listAvailableBook">  
  240.         <soap:operation soapAction="urn:listAvailableBook"  
  241.             style="document" />  
  242.         <wsdl:input>  
  243.             <soap:body use="literal" />  
  244.         </wsdl:input>  
  245.         <wsdl:output>  
  246.             <soap:body use="literal" />  
  247.         </wsdl:output>  
  248.     </wsdl:operation>  
  249. </wsdl:binding>  
  250. <wsdl:binding name="LibrarySoap12Binding" type="ns:LibraryPortType">  
  251.     <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"  
  252.         style="document" />  
  253.     <wsdl:operation name="login">  
  254.         <soap12:operation soapAction="urn:login" style="document" />  
  255.         <wsdl:input>  
  256.             <soap12:body use="literal" />  
  257.         </wsdl:input>  
  258.         <wsdl:output>  
  259.             <soap12:body use="literal" />  
  260.         </wsdl:output>  
  261.     </wsdl:operation>  
  262.     <wsdl:operation name="lendBook">  
  263.         <soap12:operation soapAction="urn:lendBook" style="document" />  
  264.         <wsdl:input>  
  265.             <soap12:body use="literal" />  
  266.         </wsdl:input>  
  267.         <wsdl:output>  
  268.             <soap12:body use="literal" />  
  269.         </wsdl:output>  
  270.     </wsdl:operation>  
  271.     <wsdl:operation name="register">  
  272.         <soap12:operation soapAction="urn:register" style="document" />  
  273.         <wsdl:input>  
  274.             <soap12:body use="literal" />  
  275.         </wsdl:input>  
  276.         <wsdl:output>  
  277.             <soap12:body use="literal" />  
  278.         </wsdl:output>  
  279.     </wsdl:operation>  
  280.     <wsdl:operation name="listAllBook">  
  281.         <soap12:operation soapAction="urn:listAllBook"  
  282.             style="document" />  
  283.         <wsdl:input>  
  284.             <soap12:body use="literal" />  
  285.         </wsdl:input>  
  286.         <wsdl:output>  
  287.             <soap12:body use="literal" />  
  288.         </wsdl:output>  
  289.     </wsdl:operation>  
  290.     <wsdl:operation name="returnBook">  
  291.         <soap12:operation soapAction="urn:returnBook" style="document" />  
  292.         <wsdl:input>  
  293.             <soap12:body use="literal" />  
  294.         </wsdl:input>  
  295.     </wsdl:operation>  
  296.     <wsdl:operation name="listLendBook">  
  297.         <soap12:operation soapAction="urn:listLendBook"  
  298.             style="document" />  
  299.         <wsdl:input>  
  300.             <soap12:body use="literal" />  
  301.         </wsdl:input>  
  302.         <wsdl:output>  
  303.             <soap12:body use="literal" />  
  304.         </wsdl:output>  
  305.     </wsdl:operation>  
  306.     <wsdl:operation name="listAvailableBook">  
  307.         <soap12:operation soapAction="urn:listAvailableBook"  
  308.             style="document" />  
  309.         <wsdl:input>  
  310.             <soap12:body use="literal" />  
  311.         </wsdl:input>  
  312.         <wsdl:output>  
  313.             <soap12:body use="literal" />  
  314.         </wsdl:output>  
  315.     </wsdl:operation>  
  316. </wsdl:binding>  
  317. <wsdl:binding name="LibraryHttpBinding" type="ns:LibraryPortType">  
  318.     <http:binding verb="POST" />  
  319.     <wsdl:operation name="login">  
  320.         <http:operation location="Library/login" />  
  321.         <wsdl:input>  
  322.             <mime:content type="text/xml" part="login" />  
  323.         </wsdl:input>  
  324.         <wsdl:output>  
  325.             <mime:content type="text/xml" part="login" />  
  326.         </wsdl:output>  
  327.     </wsdl:operation>  
  328.     <wsdl:operation name="lendBook">  
  329.         <http:operation location="Library/lendBook" />  
  330.         <wsdl:input>  
  331.             <mime:content type="text/xml" part="lendBook" />  
  332.         </wsdl:input>  
  333.         <wsdl:output>  
  334.             <mime:content type="text/xml" part="lendBook" />  
  335.         </wsdl:output>  
  336.     </wsdl:operation>  
  337.     <wsdl:operation name="register">  
  338.         <http:operation location="Library/register" />  
  339.         <wsdl:input>  
  340.             <mime:content type="text/xml" part="register" />  
  341.         </wsdl:input>  
  342.         <wsdl:output>  
  343.             <mime:content type="text/xml" part="register" />  
  344.         </wsdl:output>  
  345.     </wsdl:operation>  
  346.     <wsdl:operation name="listAllBook">  
  347.         <http:operation location="Library/listAllBook" />  
  348.         <wsdl:input>  
  349.             <mime:content type="text/xml" part="listAllBook" />  
  350.         </wsdl:input>  
  351.         <wsdl:output>  
  352.             <mime:content type="text/xml" part="listAllBook" />  
  353.         </wsdl:output>  
  354.     </wsdl:operation>  
  355.     <wsdl:operation name="returnBook">  
  356.         <http:operation location="Library/returnBook" />  
  357.         <wsdl:input>  
  358.             <mime:content type="text/xml" part="returnBook" />  
  359.         </wsdl:input>  
  360.     </wsdl:operation>  
  361.     <wsdl:operation name="listLendBook">  
  362.         <http:operation location="Library/listLendBook" />  
  363.         <wsdl:input>  
  364.             <mime:content type="text/xml" part="listLendBook" />  
  365.         </wsdl:input>  
  366.         <wsdl:output>  
  367.             <mime:content type="text/xml" part="listLendBook" />  
  368.         </wsdl:output>  
  369.     </wsdl:operation>  
  370.     <wsdl:operation name="listAvailableBook">  
  371.         <http:operation location="Library/listAvailableBook" />  
  372.         <wsdl:input>  
  373.             <mime:content type="text/xml" part="listAvailableBook" />  
  374.         </wsdl:input>  
  375.         <wsdl:output>  
  376.             <mime:content type="text/xml" part="listAvailableBook" />  
  377.         </wsdl:output>  
  378.     </wsdl:operation>  
  379. </wsdl:binding>  
  380. <wsdl:service name="Library">  
  381.     <wsdl:port name="LibraryHttpSoap11Endpoint" binding="ns:LibrarySoap11Binding">  
  382.         <soap:address  
  383.             location="http://localhost:8088/axis2/services/Library.LibraryHttpSoap11Endpoint/" />  
  384.     </wsdl:port>  
  385.     <wsdl:port name="LibraryHttpSoap12Endpoint" binding="ns:LibrarySoap12Binding">  
  386.         <soap12:address  
  387.             location="http://localhost:8088/axis2/services/Library.LibraryHttpSoap12Endpoint/" />  
  388.     </wsdl:port>  
  389.     <wsdl:port name="LibraryHttpEndpoint" binding="ns:LibraryHttpBinding">  
  390.         <http:address  
  391.             location="http://localhost:8088/axis2/services/Library.LibraryHttpEndpoint/" />  
  392.     </wsdl:port>  
  393. </wsdl:service>  
  394. lt;/wsdl:definitions>  

 

 

理解这个WSDL文件结构可能要根据写的webservice程序结构来理解:


 

 

下面标红的地方都是元素之间引用的关系。

 

1.WSDL文档的根元素:

 

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

xmlns:ns1="http://org.apache.axis2/xsd"

xmlns:ns="http://servicelifecycle.sample"

xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"

xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"

xmlns:ax21="http://bean.servicelifecycle.sample/xsd"

xmlns:xs="http://www.w3.org/2001/XMLSchema"

xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"

xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"

xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"

targetNamespace="http://servicelifecycle.sample">

 

 

 

<definitions>定义了文档中用到的各个xml元素的namespace缩写,也界定了本文档自己的 targetNamespace="http://servicelifecycle.sample",这意味着其它的XML要引用当前XML中的元素时,要声明这个namespace。注意xmlns:ns="http://www.jsoso.com/wstest"这个声明,它标示了使用ns这个前缀指向自身的命名空间。

 

2.WSDL文档数据类型定义元素:<types>:

 

 

<wsdl:types>

<xs:schema xmlns:ax22="http://bean.servicelifecycle.sample/xsd"

attributeFormDefault="qualified" elementFormDefault="qualified"

targetNamespace="http://servicelifecycle.sample">

<xs:import namespace="http://bean.servicelifecycle.sample/xsd" />

<xs:element name="returnBook">

<xs:complexType>

<xs:sequence>

<xs:element minOccurs="0" name="isbn" nillable="true"

type="xs:string" />

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="login"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="userName" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="passWord" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="loginResponse"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="return" type="xs:boolean" /> </xs:sequence> </xs:complexType> </xs:element>

 

这里定义webservice的一个元素名称returnBook,就是service的一个函数名称(见图),定义了混合类型数据类型,类型是string类型,名称叫isbn

 

3.WSDL文档消息体定义元素:< message >:

 

 

<wsdl:message name="loginRequest">

<wsdl:part name="parameters" element="ns:login" />

</wsdl:message>

<wsdl:message name="loginResponse">

<wsdl:part name="parameters" element="ns:loginResponse" />

</wsdl:message>

 

 

这里定义定义了消息请求,这里定义使用的消息是loginRequest和loginResponse,它分别引用了types中的login和loginResponse元素。在types中的login和loginResponse元素定义好了参数类型。有没有Response消息,主要是看你的函数是否有返回值,如果是void,想returnBook这函数就没有returnBookResponse。

 

4.WSDL文档操作定义元素:< portType >

 

 

<wsdl:portType name="LibraryPortType">

<wsdl:operation name="login">

<wsdl:input message="ns:loginRequest" wsaw:Action="urn:login" />

<wsdl:output message="ns:loginResponse" wsaw:Action="urn:loginResponse" />

</wsdl:operation>

 

定义了操作名称login,输入使用的消息是loginRequest,Action是urn:login,输出ns:loginResponse,Action是:urn:loginResponse

 

 

5、WSDL文档操作绑定协议<binding>:

 

<wsdl:binding name="LibrarySoap11Binding" type="ns:LibraryPortType"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <wsdl:operation name="login"> <soap:operation soapAction="urn:login" style="document" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation>

 

首先<binding>标签使用<soap:binding>的transport和style属性定义了Web Service的通讯协议HTTP和SOAP的请求风格RPC。其次<operation>子标签将portType中定义的 operation同SOAP的请求绑定,定义了操作名称soapAction,输出输入参数和异常的编码方式及命名空间。 

如果客户端要调用这方法就要声明是这soapAction名称urn:login。

 

6、WSDL文档绑定服务端口地址<service>:

 

<wsdl:service name="Library"> <wsdl:port name="LibraryHttpSoap11Endpoint" binding="ns:LibrarySoap11Binding"> <soap:address location="http://localhost:8088/axis2/services/Library.LibraryHttpSoap11Endpoint/" /> </wsdl:port> <wsdl:port name="LibraryHttpSoap12Endpoint" binding="ns:LibrarySoap12Binding"> <soap12:address location="http://localhost:8088/axis2/services/Library.LibraryHttpSoap12Endpoint/" /> </wsdl:port> <wsdl:port name="LibraryHttpEndpoint" binding="ns:LibraryHttpBinding"> <http:address location="http://localhost:8088/axis2/services/Library.LibraryHttpEndpoint/" /> </wsdl:port> </wsdl:service>

 

这里描述webservice的服务名称是Library,service是一套<port>元素。在一一对应形式下,每个<port>元素都和一个location关联。如果同一个<binding>有多个<port>元素与之关联,可以使用额外的URL地址作为替换。 


一个WSDL文档中可以有多个<service>元素,而且多个<service>元素十分有用,其中之一就是可以根据目标URL来组织端口。在一个 WSDL文档中,<service>的name属性用来区分不同的service。在同一个service中,不同端口,使用端口的"name"属性区分。 

转自:http://zengjz88.iteye.com/blog/1668725

http://tenn.iteye.com/blog/148384

http://askcuix.iteye.com/blog/212051

WSDL详解(示例复制粘贴篇):什么是WSDLWSDL的作用?WSDL文件如何生成?如何将WSDL文件生成java代码并且调用? WSDL是为描述Web服务发布的XML格式。W3C组织(World Wide Web Consortium)没有批准1.1版的WSDL,当前的WSDL版本是2.0,是W3C的推荐标准(recommendation)(一种官方标准),并将被W3C组织批准为正式标准。WSDL描述Web服务的公共接口。这是一个基于XML的关于如何与Web服务通讯和使用的服务描述;也就是描述与目录中列出的Web服务进行交互时需要绑定的协议和信息格式。 阅读详情

相关推荐

根据WebService接口地址获取接口定义文件wsdl文件

根据WebService接口地址获取接口定义文件wsdl文件) 方法一:借助SoapUI生成。 方法二:借助Visual Studio工具生成。

yinshengchen的博客 8645

WebService中的WSDL详解

WebService中的WSDL详解       有人在WebService开发的时候,特别是和第三方有接口的时候,走的是SOAP协议,然后用户(或后台)给你一个WSDL文件(或网址),说按照上面的进行适配, 这时就要对WebServiceWSDL有一定的理解,本文将对WSDLWebService描述语言)进行详细总结。        WSDL (Web Services Descriptio

wenzhi的博客 3万+

SOAP ,WSDL 和UDDI

这些描述通常用于SOAP服务,但也可以用于描述REST服务(尽管REST服务的描述通常更简单,不需要WSDL的复杂性)。

技术博客 1197

什么是WSDL

WSDL(网络服务描述语言,Web Services Description Language)是一门基于 XML 的语言,用于描述 Web Services 以及如何对它们进行访问。 wsdl:definitions name="nmtoken"? targetNamespace="uri"> import namespace="uri" location="uri"/> *

点点的博客 3万+

webService :生成wsdl文件

添加依赖 &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mav

weixin_40800533的博客 7429

WebService】第五章、WSDL文件详解

本章主要详细记录如何读懂一个WSDL描述问题。

独学而无友,则孤陋而寡闻 1万+

【超细完整版】C# WebService 通过URL生成WSDL文件和DLL文件 【生成篇】

支持通过web url (自适应“?wsdl”的有无) 生成.wsdl文件 和 .dll文件

MintYouth的博客 2395

基于wsdl 文件webService接口开发

准备工作:①、首先我们要下载:axis2-1.4.1-war(发布webservice),axis2-1.4.1-bin.zip(webservice调用使用的各种包)。②、要配置环境变量:AXIS2_HOME     1、Axis2提供了一个wsdl2java.bat命令可以根据WSDL文件自动产生调用WebService的代码。wsdl2java.bat命令可以在"bin目录中找到。在使

u013046841的专栏 7942

接口测试之(二)WebServiceWSDL文件 讲解

WebServiceWSDL文件 讲解 恩,我想说的是,是不是经常有人在开发的时候,特别是和第三方有接口的时候,走的是SOAP协议,然后用户给你一个WSDL文件,说按照上面的进行适配,嘿嘿,这个时候,要是你以前没有开发过,肯定会傻眼,那如果你想学习的话,就认真的看下面的讲解咯: 一、WSDL概述 WebServices Description Language (...

ths512的博客 3240

C#根据WSDL文件生成WebService服务端代码

虽然现在已经进入了.NET FrameWork 4.0的时代,WebService也已经逐渐被淘汰,取而代之的是WCF。 但在工作中难免遇到需要兼容旧版本程序和按照以前的文档进行开发。   一般一个已经实现功能的WebService会发布自己的WSDL文件,供客户端调用生成代理类。  但有时是先有server与client交互的接口定义(WSDL文件,然后由server和

落叶飘香 4687

利用IDEA实现通过wsdl文件增加WebService调用接口的方法

1、首先需要要调用的webservise服务器上访问wsdl的地址,如下: http:// IP地址 : 端口号/ormrpc/services 2、打开该地址如下所示:

珍惜的博客 9943

webservice调用——wsdl命令生成webservice的类文件

<br />一:首先把webservicewsdl命令生成webservice的类文件<br />      打开vs2008的命令提示输入:<br />wsdl /namespace:命名空间/out:c:/CSServices.cs http://XXXXXXXX/CSInterface/CSService.asmx<br />      类文件就会生成在C盘下面。<br />二:把文件放入项目中进行使用<br />     2.1、Web.config配置:<br /><add key="CS_Us

米粒 1971

php调用webservice wsdl发送xml文件_Webservice概念及工作原理

一、Web Service基本概念Web Service也叫XML Web Service WebService是一种可以接收从Internet或者Intranet上的其它系统中传递过来的请求,轻量级的独立的通讯技术。是:通过SOAP在Web上提供的软件服务,使用WSDL文件进行说明,并通过UDDI进行注册。XML:(Extensible Markup Language)扩展型可标记语言。面向短期...

weixin_39976960的博客 509

.net WebService wsdl 生成 dll 文件

一、利用WSDL.exe将webservice文件转化成cs类文件 開始 =》 所有程式 =》Microsoft Visual Studio 2010 =》Visual Studio Tools=》選中 Visual Studio 命令提示字元 (2010) 以系統管理員身份執行 命令: cdC:\Program Files\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools wsdl/out:XXX_WebService.csh...

Line834dch738ly的博客 896

WebService学习(wsdl文件详解,soapUI学习)

wsdl转为java代码后有什么用回答将WSDL转换为Java代码后,可以用于实现对Web服务的调用和交互。具体来说,生成的Java代码可以用于创建客户端,以便与远程Web服务进行通信。通过生成的Java代码,你可以在Java应用程序中调用远程Web服务的方法,并处理返回的数据。生成的Java代码通常包括以下内容:代表Web服务接口的Java接口代表Web服务数据类型的Java类代表Web服务方法的Java方法。

baomingshu的博客 5140

IDEA利用wsdl文件生成WebService调用接口的方法

IDEA利用wsdl文件生成WebService调用接口的方法 1、首先需要要调用的webservise服务器上访问wsdl的地址,如下: http:// IP地址 : 端口号/ormrpc/services 2、打开该地址如下所示: 如上图所示,那么访问的接口的URL地址就为http:// IP地址 : 端口号/ormrpc/services/WSTMSInterfaceFacade,webserbise调用的方法为deleteAllocation 如上图所示,那么访问的接口的URL地址就为http:

qq_38853473的博客 5930

根据wsdl离线文件如何调用webService接口

               当客户提供了一个webService接口文档,文档中包含了wsdl离线文件,我们应该如何调用webService接   口呢。现在接口调用的比较少了,写个博客记录下吧,希望下次用的时候可以快速对接接口,不用抓瞎,附   件的demo中存放了service.wsdl文件,可以根据wsdl生成客户端,配置的的是内网地址,无法访问,不过思   路一样的。 ...

iteye_930的博客 1560

基于wsdl文件用xfire生成webservice客户端

这篇笔记,只是针对于基于wsdl文件生成客户端代码后,来编写访问webservice的客户端。作为开发过程中遇到的问题的记录。 开发环境:jdk1.5、xfire-1.2.6 由于服务端并非本公司开发,所以只能拿到服务端的wsdl文件,首先想到的是,基于wsdl文件生成客户端代码,然后在此基础上按照业务来编写请求类。 XFire 官方网站 http://xfire.codehaus.org可...

xm_koma的专栏 728

webserviceWSDL文件详解

   WSDL:  Web Services Description Language  网页服务描述语言   详解WSDL文档元素: 文件是以XML格式定义的,内容分成了5大元素: 1、&lt;types&gt;:webservice使用的数据类型,它是独立以机器和语言的类型定义,这些数据类型被&lt;message&gt;标签所使用。 2、&lt;message&gt;:webse...

zengjz888的专栏 1161
上一篇: CVCV
下一篇: Hadoop技术一句话介绍
lvwenwenjava
博客等级 码龄15年 53粉丝 726原创
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值