wsdl范例

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--定义头-->
<wsdl:definitions
 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 name="SampleWebService"
 xmlns:tns="http://ws.example.com/project/servicePath"
 targetNamespace="http://ws.example.com/project/servicePath">
  
 <!--接口类型定义, Types - 数据类型定义的容器,它使用某种类型系统(一般地使用XML Schema中的类型系统)。 -->
 <wsdl:types>
  
  <!-- 命名空间 -->
  <xsd:schema targetNamespace="http://ws.example.com/project/servicePath">  
  
   <!--请求中复杂对象类型-->
   <xsd:complexType name="Inner">
       <xsd:sequence>
        <xsd:element name="innerId" type="xsd:string" maxOccurs="1" minOccurs="1"/>
        <xsd:element name="salutation" maxOccurs="1" minOccurs="0">
         <xsd:simpleType>
          <xsd:restriction base="xsd:string">
           <xsd:enumeration value="1"/>
           <xsd:enumeration value="2"/>
           <xsd:enumeration value="3"/>
          </xsd:restriction>
         </xsd:simpleType>
        </xsd:element>
        <xsd:element name="birthday" maxOccurs="1" minOccurs="0">
         <xsd:simpleType>
          <xsd:restriction base="xsd:string">
           <xsd:pattern value="\d{8}"/>
          </xsd:restriction>
         </xsd:simpleType>
        </xsd:element>
       </xsd:sequence>
   </xsd:complexType>
     
      <!--响应中复杂对象类型-->
      <xsd:complexType name="WSResponse">
       <xsd:sequence>
        <xsd:element name="code" type="xsd:string" maxOccurs="1" minOccurs="1"/>
        <xsd:element name="errorMessage" type="xsd:string" maxOccurs="1" minOccurs="0"/>
        <xsd:element name="inner" type="tns:Inner" maxOccurs="1" minOccurs="0"/>
       </xsd:sequence>
      </xsd:complexType>
   
   <!--请求类型-->
   <xsd:element name="sampleInterface">
          <xsd:complexType>
           <xsd:sequence>
               <xsd:element name="inner" type="tns:Inner" maxOccurs="1" minOccurs="1"/>
           </xsd:sequence>
          </xsd:complexType>
   </xsd:element>
      
   <!--响应类型-->
   <xsd:element name="sampleInterfaceResponse">
          <xsd:complexType>
           <xsd:sequence>
               <xsd:element name="out" type="tns:WSResponse" maxOccurs="1" minOccurs="0"/>
           </xsd:sequence>
          </xsd:complexType>
   </xsd:element>
   
  </xsd:schema>
  
 </wsdl:types>
  
 <!--请求消息定义 , Message - 通信消息的数据结构的抽象类型化定义。使用Types所定义的类型来定义整个消息的数据结构。-->
 <wsdl:message name="sampleInterfaceRequest">
  <wsdl:part name="sampleInterfaceRequest" element="tns:sampleInterface"/>

 </wsdl:message>
 
 <!--消息响应定义-->
 <wsdl:message name="sampleInterfaceResponse">
  <wsdl:part name="sampleInterfaceResponse" element="tns:sampleInterfaceResponse"/>
 </wsdl:message>
 
 <!--绑定端口定义, PortType - 对于某个访问入口点类型所支持的操作的抽象集合,这些操作可以由一个或多个服务访问点来支持。 -->
 <wsdl:portType name="SampleSOAP">
  <!-- 操作, Operation - 对服务中所支持的操作的抽象描述,一般单个Operation描述了一个访问入口的请求/响应消息对。 -->
     <wsdl:operation name="sampleInterface">
       <wsdl:input message="tns:sampleInterfaceRequest"/>
       <wsdl:output message="tns:sampleInterfaceResponse"/>
     </wsdl:operation>

 </wsdl:portType>
  
 <!--绑定信息, Binding - 特定端口类型的具体协议和数据格式规范的绑定。 -->
 <wsdl:binding name="ServiceSOAP" type="tns:SampleSOAP">
  
  <!--绑定类型-->
   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
   
   <!--绑定接口定义-->
   <wsdl:operation name="sampleInterface">
   
    <soap:operation soapAction="http://ws.example.com/project/servicePath/sampleInterface" />
    
    <!--输入-->
    <wsdl:input>
    <soap:body use="literal" />
    </wsdl:input>
    
    <!--输出-->
    <wsdl:output>
    <soap:body use="literal" />
   </wsdl:output>
   </wsdl:operation>
   
  </wsdl:binding>
  
 <!--服务信息, Service- 相关服务访问点的集合。-->
 <wsdl:service name="Sample">
     <wsdl:port binding="tns:ServiceSOAP" name="SampleSOAP">
       <soap:address location=">
     </wsdl:port>
 </wsdl:service>
 
</wsdl:definitions>
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值