WSDL 服务文档把一组相关端口分组到一起。WSDL 服务文档相当于发布到 UDDI 注册中心的企业服务。可以生成包含所有 WSDL 元素的整体式 WSDL 文档,也可以生成单独的 WSDL 服务文档。
以下 WSDL 服务文档基于 StockQuoteService 样本。
<?xml version="1.0" encoding="UTF-8"?> <definitions name="StockQuoteServiceService" targetNamespace="http:///" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http:///"> <import location="StockQuoteServiceBinding.wsdl" namespace="http:///"/> <service name="StockQuoteServiceService">
<!-- The port element StockQuoteServicePort contains the --> <!-- SOAP address http://localhost:8080/WebProject/servlet/rpcrouter. --> <!-- This address is the URL under which the RPC router servlet of the --> <!-- service provider's SOAP server can be reached. The port --> <!-- references the binding in the interface file. The qualified name --> <!-- binding:StockQuoteServiceBinding is used in this case since the --> <!-- interface file uses a different namespace than the implementation file. -->
<port binding="tns:StockQuoteServiceBinding" name="StockQuoteServicePort"> <soap:address location="http://localhost:9080/WebProject/servlet/rpcrouter"/> </port> </service> </definitions>