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>