JAX-RPC 与 JAX-WS 的比较,第 3 部分:服务端点接口
2009-11-03 00:00:00 来源:WEB开发网引言
从整体上看,Java API for XML-based RPC (JAX-RPC) 1.1 服务端点接口 (SEI) 和 Java API for XML Web Services (JAX-WS) 2.0 SEI 是非常相似的。本文将着重介绍它们之间的区别。尽管在结构上存在一定的区别,然而,提供反映 Web 服务契约的接口的目标是相同的。
比较 SEI 映射
清单 1 显示了一个简单的 HelloWorld Web 服务所使用的 WSDL。
清单 1. HelloWorld WSDL
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="urn:helloWorld/sample/ibm/com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorld"
targetNamespace="urn:helloWorld/sample/ibm/com">
<wsdl:types>
<xsd:schema targetNamespace="urn:helloWorld/sample/ibm/com"
xmlns:tns="urn:helloWorld/sample/ibm/com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="hello">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="helloResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="response" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="helloRequestMsg">
<wsdl:part element="tns:hello" name="helloParameters" />
</wsdl:message>
<wsdl:message name="helloResponseMsg">
<wsdl:part element="tns:helloResponse" name="helloResult" />
</wsdl:message>
<wsdl:portType name="HelloWorld">
<wsdl:operation name="hello">
<wsdl:input message="tns:helloRequestMsg" name="helloRequest" />
<wsdl:output message="tns:helloResponseMsg" name="helloResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloWorldBinding" type="tns:HelloWorld">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="hello">
<soap:operation soapAction="urn:helloWorld/sample/ibm/com/hello" />
<wsdl:input name="helloRequest">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="helloResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HelloWorldService">
<wsdl:port name="port" binding="tns:HelloWorldBinding">
<soap:address location="http://tempuri.org/" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
更多精彩
赞助商链接