wsdl详细说明

<!- 
整个wsdl就相当于在定义一个类,types是导入包,message是定义private参数,portType是定义具体的接口,binding是实现接口,service是公布方法让别人调用

第一部分一些声明 
1、wsdl的顶级元素为definitions
2、xmlns:xsd="http://www.w3.org/2001/XMLSchema -->>定义命名空间,这个wsdl的系统元素(xsd:schema)全部属于这个命名空间,xmlns即是xml namespace,后面的:xsd告诉大家这个命名空间的前缀是xsd,以后要使用这个命名空间里面的元素就得加xsd,如下面引入xsd文件的时候使用<xsd:schema> </xsd:schema>。当然命名空间就是相当于声明不同的包,不同的范围。
3、xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/ -- >>同上面一样,凡是使用到这个命名空间的元素就得使用wsdl前缀开头,如<wsdl:definitions></wsdl:definitions> 、<wsdl:types></wsdl:types>\<wsdl:message></wsdl:messgae>
4、xmlns:tns_domain="http://www.deppon.com/esb/inteface/domain/crm -->>下面类似的这种形式的命名空间都是我们自己定义,根据实际需求自定义,这个crm包含了到crm系统的命名空间的具体内容,下面有用得到(<wsdl:type></wsdl:type>中)
5、targetNamespace="http://www.deppon.com/foss/customerService -->>是本例的整个wsdl文档的命名空间,也是自定义的。而这句:xmlns:tns="http://www.deppon.com/foss/customerService则是告诉我们本个wsdl文档中定义的元素,引用时需要带tns前缀。比如第5部分中的binding中需要引用第3部分中定义在本个wsdl中的QureyIsCustomerBlankOutRequest,则需要写成tns:QureyIsCustomerBlankOutRequest。
6、name="CustomerService" -->>是代表整个wsdl,在下面的内容中用不到,直接用已经声明的前缀tns代表整个wsdl
->
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:tns_header="http://www.deppon.com/esb/header" 
xmlns:tns_exception="http://www.deppon.com/esb/exception" 
xmlns:tns_domain="http://www.deppon.com/esb/inteface/domain/crm"
 xmlns:tns="http://www.deppon.com/foss/customerService"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
name="CustomerService" 
targetNamespace="http://www.deppon.com/foss/customerService">
<!-
   第二部分Types
1、
 ->
<wsdl:types>
<xsd:schema 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
<!-
    观察下面的CRM_QUREY_ISCUSTOMERBLANKOUT.xsd,里面无需引用到header、exception、customerservice、soap的东西,都可以把他们删了
 ->
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:tns_header="http://www.deppon.com/esb/header"
xmlns:tns_exception="http://www.deppon.com/esb/exception" 
xmlns:tns_domain="http://www.deppon.com/esb/inteface/domain/crm"
xmlns:tns="http://www.deppon.com/foss/customerService" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
targetNamespace="http://www.deppon.com/esb/inteface/domain/crm">
<!-
    引入CRM_QUREY_ISCUSTOMERBLANKOUT.xsd规范定义,还可以直接把schema定义到本个wsdl中,但是为了看起来不是那么复杂,我们还是在外面定义之后在引入
 ->
<xsd:include schemaLocation="http://192.168.17.141:17080/esb2/ws/crm2foss/customerService?xsd=CRM_QUREY_ISCUSTOMERBLANKOUT.xsd"/>
</xsd:schema>


<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns_header="http://www.deppon.com/esb/header"
targetNamespace="http://www.deppon.com/esb/header">
<!-
    引入ESBHeader.xsd规范定义
 ->
<xsd:include schemaLocation="http://192.168.17.141:17080/esb2/ws/crm2foss/customerService?xsd=ESBHeader.xsd"/>
</xsd:schema>


<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:tns_exception="http://www.deppon.com/esb/exception" 
targetNamespace="http://www.deppon.com/esb/exception">
<!-
    引入CommonException.xsd规范定义
 ->
<xsd:include schemaLocation="http://192.168.17.141:17080/esb2/ws/crm2foss/customerService?xsd=CommonException.xsd"/>
</xsd:schema>
</wsdl:types>

<!- 
  第三部分message 
  相当于定义一个方法的参数,传入参数和传出参数
  QureyIsCustomerBlankOutRequest:传入参数,tns:domain是在最开始的元素definitions中声明的,在types中引入的xsd文件的targetnamespace。
  所以tns:QureyIsCustomerBlankOutRequest来自于CRM_QUREY_ISCUSTOMERBLANKOUT.xsd中定义,同          理tns_domain:isCustomerBlankOutResponse、tns_header:esbHeader也是来自对应的xsd文件。
->
<wsdl:message name="QureyIsCustomerBlankOutRequest">
<wsdl:part element="tns_domain:isCustomerBlankOutRequest" name="request"></wsdl:part>
<wsdl:part element="tns_header:esbHeader" name="esbHeader"></wsdl:part>
</wsdl:message>
<wsdl:message name="QureyIsCustomerBlankOutResponse">
<wsdl:part element="tns_domain:isCustomerBlankOutResponse" name="response"></wsdl:part>
<wsdl:part element="tns_header:esbHeader" name="esbHeader"></wsdl:part>
</wsdl:message>
<wsdl:message name="ESBHeader">
<wsdl:part element="tns_header:esbHeader" name="header"></wsdl:part>
</wsdl:message>
<!- 
  第四部分portType 
  相当于定义接口
  定义一个QureyIsCustomeBlankOut接口,传入参数tns:QureyIsCustomerBlankOutRequest是依赖message中定义的参数;
  传出参数tns:QureyIsCustomerBlankOutResponse是依赖message中定义的参数;同理
->
<wsdl:portType name="CustomerService">
<wsdl:operation name="QureyIsCustomeBlankOut">
<wsdl:input message="tns:QureyIsCustomerBlankOutRequest"></wsdl:input>
<wsdl:output message="tns:QureyIsCustomerBlankOutResponse"></wsdl:output>
<wsdl:fault message="tns:CommonException" name="exception"></wsdl:fault>
</wsdl:operation>
</wsdl:portType>
<!- 
  第五部分binding 
  相当于接口的具体实现
  
->
<wsdl:binding name="CustomerServiceSOAP" type="tns:CustomerService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="QureyIsCustomeBlankOut">
<soap:operation soapAction="http://www.deppon.com/foss/customerService/QureyIsCustomeBlankOut"/>
<wsdl:input>
<soap:header message="tns:QureyIsCustomerBlankOutRequest" part="esbHeader" use="literal"></soap:header>
<soap:body parts="request" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:header message="tns:QureyIsCustomerBlankOutResponse" part="esbHeader" use="literal"></soap:header>
<soap:body parts="response"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<!- 
  第六部分service
  相当于发布方法让别人调用
 ->
<wsdl:service name="CustomerService">
<wsdl:port binding="tns:CustomerServiceSOAP" name="CustomerServiceSOAP">
<soap:address location="http://192.168.17.141:17080/esb2/ws/crm2foss/customerService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>


下面是CRM_QUREY_ISCUSTOMERBLANKOUT.xsd,查询客户是否可作废 接口的schema定义
================================================================================================================================
<schema xmlns:tns="http://www.deppon.com/esb/inteface/domain/crm" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"targetNamespace="http://www.deppon.com/esb/inteface/domain/crm">
<!-- 查询客户是否可作废 -->
<element name="isCustomerBlankOutRequest" type="tns:IsCustomerBlankOutRequest"/>
<element name="isCustomerBlankOutResponse" type="tns:IsCustomerBlankOutResponse"/>
<complexType name="IsCustomerBlankOutRequest">
<annotation>
<documentation>传入的查询参数</documentation>
</annotation>
<sequence>
<element maxOccurs="unbounded" minOccurs="1" name="customerCodeList" type="string">
<annotation>
<documentation>客户编码列表</documentation>
</annotation>
</element>
</sequence>
</complexType>
<complexType name="IsCustomerBlankOutResponse">
<annotation>
<documentation>客户是否允许作废信息列表</documentation>
</annotation>
<sequence>
<element maxOccurs="unbounded" minOccurs="1" name="resultInfoList" type="tns:IsCustomerBlankOutList"></element>
</sequence>
</complexType>
<complexType name="IsCustomerBlankOutList">
<sequence>
<element maxOccurs="1" minOccurs="1" name="customerCode" type="string">
<annotation>
<documentation>客户编码</documentation>
</annotation>
</element>
<element maxOccurs="1" minOccurs="1" name="IsCustomerBlankOut" type="boolean">
<annotation>
<documentation>客户是否可作废标志</documentation>
</annotation>
</element>
</sequence>
</complexType>
</schema>

下面是CommonException.xsd,通用异常信息的schema定义
================================================================================================================================
<schema xmlns:tns="http://www.deppon.com/esb/exception" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"targetNamespace="http://www.deppon.com/esb/exception">
<complexType name="CommonExceptionInfo">
<sequence>
<element maxOccurs="1" minOccurs="1" name="exceptioncode" type="string">
<annotation>
<documentation>
异常的编码,ESB本身产生的异常编码格式为:ESB+nnnnnn,例如:ESB000001表示服务编码不存在
</documentation>
</annotation>
</element>
<element maxOccurs="1" minOccurs="1" name="exceptiontype" type="string">
<annotation>
<documentation>
异常的类型,默认是业务异常:SystemException(系统异常)、BusinessException(业务异常)
</documentation>
</annotation>
</element>
<element maxOccurs="1" minOccurs="1" name="message" type="string">
<annotation>
<documentation> 异常消息,用于显示给最终用户 </documentation>
</annotation>
</element>
<element maxOccurs="1" minOccurs="1" name="createdTime" type="dateTime">
<annotation>
<documentation> 异常发生时间 </documentation>
</annotation>
</element>
<element maxOccurs="1" minOccurs="1" name="detailedInfo" type="string">
<annotation>
<documentation> 异常的详细消息,用于系统管理员诊断 </documentation>
</annotation>
</element>
</sequence>
</complexType>
<element name="commonExceptionInfo" type="tns:CommonExceptionInfo"/>
</schema>

ESBHeader.xsd略


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值