使用webservice也已经有一段时间了,现在比较清闲,书写一下自己的心得。
wsdl(Web Service Description Language),描述怎样提供网络服务,包括与什么协议进行绑定、参数类型、校验(schema)、访问入口等等。
wsdl的元素类型如下:
type、message、operation porttype(这四个元素是抽象的,只是定义一种描述)
service binding port是具体的实现
之间的依赖关系如下(图使用ppt作的,比较丑^_^)
[img] http://pippo25.iteye.com/upload/picture/pic/13369/9b057d82-49f9-3a7a-9a19-f346068d1fbe.jpg [/img]
1.types:分为imapleType 和 complesType两种,如:
2.Message:描述消息,使用types类型定义的参数组成消息
如:
3.Operation:描述操作。使用message描述的参数。定义了一个访问入口的 请求/响应消息对。
如:
4.porttype:定义了所有操作的集合,由operation组成。
如:
上面的四个元素只是描述,没有涉及到真正的服务实现方式。
5.Service:相关服务访问点的集合。
6.Binding:结构定义了某个PortType与某一种具体的网络传输协议或消息传输协议相绑定,从这一层次开始,描述的内容就与具体服务的部署相关了。比如可以将PortType与SOAP/HTTP绑定,也可以将PortType与MIME/SMTP相绑定等。
如:
7.port:Port描述的是一个服务访问入口的部署细节,包括通过哪个Web地址(URL)来访问,应当使用怎样的消息调用模式来访问等。其中消息调用模式则是使用Binding结构来表示。
如:
一个WSDL中,definition是整个文档的根元素,一个文档中可能存在多个Service元素,service是服务的入口点。 Service 中可能有多个port,每个port对应一个PortType,PortType可能对应一组operation
wsdl(Web Service Description Language),描述怎样提供网络服务,包括与什么协议进行绑定、参数类型、校验(schema)、访问入口等等。
wsdl的元素类型如下:
type、message、operation porttype(这四个元素是抽象的,只是定义一种描述)
service binding port是具体的实现
之间的依赖关系如下(图使用ppt作的,比较丑^_^)
[img] http://pippo25.iteye.com/upload/picture/pic/13369/9b057d82-49f9-3a7a-9a19-f346068d1fbe.jpg [/img]
1.types:分为imapleType 和 complesType两种,如:
<element name="add">
<complexType>
<sequence>
<element name="x" type="xsd:int"/>
<element name="y" type="xsd:int"/>
</sequence>
</complexType>
</element>
2.Message:描述消息,使用types类型定义的参数组成消息
如:
<wsdl:message name="addRequest">
<wsdl:part element="impl:add" name="parameters"/>
</wsdl:message>
3.Operation:描述操作。使用message描述的参数。定义了一个访问入口的 请求/响应消息对。
如:
<wsdl:operation name="subtract">
<wsdl:input message="impl:subtractRequest" name="subtractRequest"/>
<wsdl:output message="impl:subtractResponse" name="subtractResponse"/>
</wsdl:operation>
4.porttype:定义了所有操作的集合,由operation组成。
如:
<wsdl:portType name="EngineImpl">
<wsdl:operation name="add">
<wsdl:input message="impl:addRequest" name="addRequest"/>
<wsdl:output message="impl:addResponse" name="addResponse"/>
</wsdl:operation>
<wsdl:operation name="subtract">
<wsdl:input message="impl:subtractRequest" name="subtractRequest"/>
<wsdl:output message="impl:subtractResponse" name="subtractResponse"/>
</wsdl:operation>
<wsdl:operation name="divide">
<wsdl:input message="impl:divideRequest" name="divideRequest"/>
<wsdl:output message="impl:divideResponse" name="divideResponse"/>
</wsdl:operation>
<wsdl:operation name="multiply">
<wsdl:input message="impl:multiplyRequest" name="multiplyRequest"/>
<wsdl:output message="impl:multiplyResponse" name="multiplyResponse"/>
</wsdl:operation>
</wsdl:portType>
上面的四个元素只是描述,没有涉及到真正的服务实现方式。
5.Service:相关服务访问点的集合。
6.Binding:结构定义了某个PortType与某一种具体的网络传输协议或消息传输协议相绑定,从这一层次开始,描述的内容就与具体服务的部署相关了。比如可以将PortType与SOAP/HTTP绑定,也可以将PortType与MIME/SMTP相绑定等。
如:
<wsdl:binding name="EngineImplSoapBinding" type="impl:EngineImpl">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="add">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="addRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="addResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="subtract">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="subtractRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="subtractResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="divide">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="divideRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="divideResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="multiply">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="multiplyRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="multiplyResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
7.port:Port描述的是一个服务访问入口的部署细节,包括通过哪个Web地址(URL)来访问,应当使用怎样的消息调用模式来访问等。其中消息调用模式则是使用Binding结构来表示。
如:
<wsdl:port binding="impl:EngineImplSoapBinding" name="EngineImpl">
<wsdlsoap:address location="http://localhost:8010/WebService/services/EngineImpl"/>
</wsdl:port>
一个WSDL中,definition是整个文档的根元素,一个文档中可能存在多个Service元素,service是服务的入口点。 Service 中可能有多个port,每个port对应一个PortType,PortType可能对应一组operation