Wsdl文件详细介绍

PANTONE色卡-潘通色卡-金属色色卡-GG1
550.0元 

【wayfoon】

myeclipse 里面生成wsdl文件

 

wayfoon

 

Soap Binding Options 有三种方式,这就是Wsdl文件中 Style和use的组合

use属性可以为literal,encoded;style可以为rpc,document,我们来对五种类型的style/use决定的binding作一比较,分别是rpc/literal, document/literal none-wrapper, document/literal with wrapper, rpc/encoded, 以及document/encoded。

从生成soap消息的角度看,rpc和document的差别在于方法的操作名是否出现在生成的Soap消息中,encoded和literal编码方式的差别在于参数类型是否出现在生成的Soap消息中。

这样rpc/encoded能够完整地表示一个方法调用,但缺点是性能很差,而且不能校验Soap消息的有效性。

rpc/literal不对参数类型进行编码,但仍然无法对Soap消息进行校验。Document/encoded没有意义,因为没有方法名,对参数类型编码没有什么意义。

document/literal none-wrapper无法生成操作名,适用于完整的文档作为参数传递给方法的场景。

document/literal with wrapper应该是目前使用最多的方式,在xfire中也是默认配置。

例子代码中的Style和use的组合设置

 <wsdl:binding name="helloHttpBinding" type="tns:helloPortType">
    <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="example">
      <wsdlsoap:operation soapAction=""/>
      <wsdl:input name="exampleRequest">
        <wsdlsoap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="exampleResponse">
        <wsdlsoap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

 

 

输入String 返回对象数组的wsdl文件例子:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <wsdl:definitions targetNamespace="http://wayfoon.org" xmlns:tns="http://wayfoon.org" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding" xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  3.   <wsdl:types>
  4. <xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://wayfoon.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  5. <xsd:element name="examplein0" type="xsd:string"/>
  6. <xsd:complexType name="ArrayOfHelloBean">
  7. <xsd:sequence>
  8. <xsd:element maxOccurs="unbounded" minOccurs="0" name="HelloBean" nillable="true" type="tns:HelloBean"/>
  9. </xsd:sequence>
  10. </xsd:complexType>
  11. <xsd:complexType name="HelloBean">
  12. <xsd:sequence>
  13. <xsd:element minOccurs="0" name="id" nillable="true" type="xsd:string"/>
  14. <xsd:element minOccurs="0" name="name" nillable="true" type="xsd:string"/>
  15. </xsd:sequence>
  16. </xsd:complexType>
  17. <xsd:element name="exampleout" type="tns:ArrayOfHelloBean"/>
  18. </xsd:schema>
  19.   </wsdl:types>
  20.   <wsdl:message name="exampleResponse">
  21.     <wsdl:part name="exampleout" element="tns:exampleout">
  22.     </wsdl:part>
  23.   </wsdl:message>
  24.   <wsdl:message name="exampleRequest">
  25.     <wsdl:part name="examplein0" element="tns:examplein0">
  26.     </wsdl:part>
  27.   </wsdl:message>
  28.   <wsdl:portType name="helloPortType">
  29.     <wsdl:operation name="example">
  30.       <wsdl:input name="exampleRequest" message="tns:exampleRequest">
  31.     </wsdl:input>
  32.       <wsdl:output name="exampleResponse" message="tns:exampleResponse">
  33.     </wsdl:output>
  34.     </wsdl:operation>
  35.   </wsdl:portType>
  36.   <wsdl:binding name="helloHttpBinding" type="tns:helloPortType">
  37.     <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
  38.     <wsdl:operation name="example">
  39.       <wsdlsoap:operation soapAction=""/>
  40.       <wsdl:input name="exampleRequest">
  41.         <wsdlsoap:body use="literal"/>
  42.       </wsdl:input>
  43.       <wsdl:output name="exampleResponse">
  44.         <wsdlsoap:body use="literal"/>
  45.       </wsdl:output>
  46.     </wsdl:operation>
  47.   </wsdl:binding>
  48.   <wsdl:service name="hello">
  49.     <wsdl:port name="helloHttpPort" binding="tns:helloHttpBinding">
  50.       <wsdlsoap:address location="http://192.168.0.70:8080/tt/services/hello"/>
  51.     </wsdl:port>
  52.   </wsdl:service>
  53. </wsdl:definitions>

 

 

作者:南极光  
时间:2008-9-5

欢迎大家同我联系,wayfoon@163.com
欢迎转载,转载请保留申明信息。

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值