wsdl详细说明

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
[color=red]<!-- 整个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.ruicong.com/esb/inteface/domain/crm 下面类似的这种形式的命名空间都是我们自己定义,根据实际需求自定义,这个crm包含了到crm系统的命名空间的具体内容,下面有用得到(<wsdl:type></wsdl:type>中)
5、targetNamespace="http://www.ruicong.com/foss/customerService 是本例的整个wsdl文档的命名空间,也是自定义的。而这句:xmlns:tns="http://www.ruicong.com/foss/customerService则是告诉我们本个wsdl文档中定义的元素,引用时需要带tns前缀。比如第5部分中的binding中需要引用第3部分中定义在本个wsdl中的QureyIsCustomerBlankOutRequest,则需要写成tns:QureyIsCustomerBlankOutRequest。
6、name="CustomerService" 是代表整个wsdl,在下面的内容中用不到,直接用已经声明的前缀tns代表整个wsdl
-->[/color]
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns_header="http://www.ruicong.com/esb/header"
xmlns:tns_exception="http://www.ruicong.com/esb/exception"
xmlns:tns_domain="http://www.ruicong.com/esb/inteface/domain/crm"
xmlns:tns="http://www.ruicong.com/foss/CustomerService/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CustomerService"
targetNamespace="http://www.ruicong.com/foss/CustomerService/">
<!-- 第二部分Types -->
<wsdl:types>
<!-- 观察下面的CRM_QUREY_ISCUSTOMERBLANKOUT.xsd,里面无需引用到header、exception、customerservice、soap的东西,都可以把他们删了 -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns_domain="http://www.ruicong.com/esb/inteface/domain/crm"
targetNamespace="http://www.ruicong.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.ruicong.com/esb/header"
targetNamespace="http://www.ruicong.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.ruicong.com/esb/exception"
targetNamespace="http://www.ruicong.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>
<wsdl:message name="CommonException">
<wsdl:part element="tns_exception:commonExceptionInfo" name="exception"/>
</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.ruicong.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>

[color=red]
//***************************** CRM_QUREY_ISCUSTOMERBLANKOU.xsd *************[/color]
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.ruicong.com/esb/inteface/domain/crm"
xmlns:tns="http://www.ruicong.com/esb/inteface/domain/crm"
elementFormDefault="qualified">

<!-- 查询客户是否可作废 -->
<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>


[color=red]//*********************** ESBHeader.xsd ******************************[/color]

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.ruicong.com/esb/header"
xmlns:tns="http://www.ruicong.com/esb/header" elementFormDefault="qualified">
<complexType name="ESBHeader">
<sequence>
<element name="version" type="string" minOccurs="1"
maxOccurs="1">
<annotation>
<documentation>版本号, 编码规则由各应用自行决定</documentation>
</annotation>
</element>

<element name="businessId" type="string" minOccurs="1"
maxOccurs="1">
<annotation>
<documentation>用于两端应用跟踪服务,属于同一个businessId的消息即表示在业务含义上相同。
</documentation>
</annotation>
</element>
<element name="businessDesc1" type="string" minOccurs="0"
maxOccurs="1">
<annotation>
<documentation>业务保留字段1,用于描述业务的辅助信息
</documentation>
</annotation>
</element>
<element name="businessDesc2" type="string" minOccurs="0"
maxOccurs="1">
<annotation>
<documentation>业务保留字段2,用于描述业务的辅助信息
</documentation>
</annotation>
</element>
<element name="businessDesc3" type="string" minOccurs="0"
maxOccurs="1">
<annotation>
<documentation>业务保留字段3,用于描述业务的辅助信息
</documentation>
</annotation>
</element>
<element name="requestId" type="string" minOccurs="1"
maxOccurs="1">
<annotation>
<documentation>用于标识请求消息的唯一性</documentation>
</annotation>
</element>
<element name="responseId" type="string" minOccurs="0"
maxOccurs="1">
<annotation>
<documentation>用于标识响应消息的唯一性</documentation>
</annotation>
</element>

<element name="sourceSystem" type="string" minOccurs="1"
maxOccurs="1">
<annotation>
<documentation>记录客户端的前端接入系统标识,ESB为每个接入的系统设定固定的常量,如ERP, CRM, OA。。。
</documentation>
</annotation>
</element>
<element name="targetSystem" type="string" minOccurs="0"
maxOccurs="1">
<annotation>
<documentation>记录客户端的后端接入系统标识</documentation>
</annotation>
</element>
<element name="esbServiceCode" type="string" minOccurs="1"
maxOccurs="1">
<annotation>
<documentation>ESB提供给服务消费端的服务编码</documentation>
</annotation>
</element>
<element name="backServiceCode" type="string" minOccurs="0"
maxOccurs="1">
<annotation>
<documentation>服务提供端提供给ESB的服务编码</documentation>
</annotation>
</element>

<element name="messageFormat" type="string" minOccurs="0"
maxOccurs="1">
<annotation>
<documentation>消息格式,如SOAP,XML,JSON,Binary等,这些格式可扩展</documentation>
</annotation>
</element>

<element name="exchangePattern" type="int" minOccurs="0"
maxOccurs="1">
<annotation>
<documentation>1- 请求/响应,2-请求/回调,3-单向(只有请求没有结果返回)</documentation>
</annotation>
</element>

<element name="sentSequence" type="int" minOccurs="0"
maxOccurs="1">
<annotation>
<documentation>用来标识是否是重发的消息,第一次发送为1,后续每次重发加1</documentation>
</annotation>
</element>

<element name="resultCode" minOccurs="0" type="int" maxOccurs="1">
<annotation>
<documentation>响应结果状态:0-失败,1-成功</documentation>
</annotation>
</element>

<element name="authentication" type="tns:AuthInfo" minOccurs="0"
maxOccurs="1">
<annotation>
<documentation>用户认证信息</documentation>
</annotation>
</element>

<element name="statusList" type="tns:StatusList" minOccurs="0"
maxOccurs="1">
<annotation>
<documentation>状态信息,可用于记录执行状态和对应的时间戳</documentation>
</annotation>
</element>
</sequence>
</complexType>

<complexType name="AuthInfo">
<sequence>
<element name="username" type="string" minOccurs="0"
maxOccurs="1">
<annotation>
<documentation>用户名</documentation>
</annotation>
</element>
<element name="password" type="string" minOccurs="0"
maxOccurs="1">
<annotation>
<documentation>密码</documentation>
</annotation>
</element>
</sequence>
</complexType>

<complexType name="StatusList">
<sequence>
<element name="statusInfo" type="tns:StatusInfo" minOccurs="0"
maxOccurs="unbounded">
<annotation>
<documentation>状态列表</documentation>
</annotation>
</element>
</sequence>
</complexType>
<complexType name="StatusInfo">
<sequence>
<element name="statusId" type="string" minOccurs="1" maxOccurs="1">
<annotation>
<documentation>状态码</documentation>
</annotation>
</element>
<element name="timeStamp" type="long" minOccurs="1"
maxOccurs="1">
<annotation>
<documentation>自从1970-1-1 以来经过的毫秒数</documentation>
</annotation>
</element>
</sequence>
</complexType>

<element name="esbHeader" type="tns:ESBHeader"></element>

</schema>

[color=red]//************************* CommonException.xsd **********************[/color]

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.ruicong.com/esb/exception"
xmlns:tns="http://www.ruicong.com/esb/exception" elementFormDefault="qualified">

<complexType name="CommonExceptionInfo">
<sequence>
<element name="exceptioncode" type="string" minOccurs="1"
maxOccurs="1">
<annotation>
<documentation>异常的编码,ESB本身产生的异常编码格式为:ESB+nnnnnn,例如:ESB000001表示服务编码不存在</documentation>
</annotation>
</element>
<element name="exceptiontype" minOccurs="1" type="string" maxOccurs="1">
<annotation>
<documentation>异常的类型,默认是业务异常:SystemException(系统异常)、BusinessException(业务异常)</documentation>
</annotation>
</element>
<element name="message" type="string" minOccurs="1"
maxOccurs="1">
<annotation>
<documentation>异常消息,用于显示给最终用户</documentation>
</annotation>
</element>

<element name="createdTime" type="dateTime" minOccurs="1"
maxOccurs="1">
<annotation>
<documentation>异常发生时间</documentation>
</annotation>
</element>

<element name="detailedInfo" type="string" minOccurs="1"
maxOccurs="1">
<annotation>
<documentation>异常的详细消息,用于系统管理员诊断</documentation>
</annotation>
</element>
</sequence>
</complexType>


<element name="commonExceptionInfo" type="tns:CommonExceptionInfo"></element>

</schema>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值