| PANTONE色卡-潘通色卡-金属色色卡-GG1 | |
550.0元 |
【wayfoon】
myeclipse 里面生成wsdl文件
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文件例子:
- <?xml version="1.0" encoding="UTF-8"?>
- <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/">
- <wsdl:types>
- <xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://wayfoon.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <xsd:element name="examplein0" type="xsd:string"/>
- <xsd:complexType name="ArrayOfHelloBean">
- <xsd:sequence>
- <xsd:element maxOccurs="unbounded" minOccurs="0" name="HelloBean" nillable="true" type="tns:HelloBean"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="HelloBean">
- <xsd:sequence>
- <xsd:element minOccurs="0" name="id" nillable="true" type="xsd:string"/>
- <xsd:element minOccurs="0" name="name" nillable="true" type="xsd:string"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:element name="exampleout" type="tns:ArrayOfHelloBean"/>
- </xsd:schema>
- </wsdl:types>
- <wsdl:message name="exampleResponse">
- <wsdl:part name="exampleout" element="tns:exampleout">
- </wsdl:part>
- </wsdl:message>
- <wsdl:message name="exampleRequest">
- <wsdl:part name="examplein0" element="tns:examplein0">
- </wsdl:part>
- </wsdl:message>
- <wsdl:portType name="helloPortType">
- <wsdl:operation name="example">
- <wsdl:input name="exampleRequest" message="tns:exampleRequest">
- </wsdl:input>
- <wsdl:output name="exampleResponse" message="tns:exampleResponse">
- </wsdl:output>
- </wsdl:operation>
- </wsdl:portType>
- <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>
- <wsdl:service name="hello">
- <wsdl:port name="helloHttpPort" binding="tns:helloHttpBinding">
- <wsdlsoap:address location="http://192.168.0.70:8080/tt/services/hello"/>
- </wsdl:port>
- </wsdl:service>
- </wsdl:definitions>
作者:南极光
时间:2008-9-5
欢迎大家同我联系,wayfoon@163.com
欢迎转载,转载请保留申明信息。