<service name="StockQuoteService">
<port name="StockQuoteSOAPPort" binding="tns:StockQuoteSOAPBinding">
<soap:address location="http://localhost:8080/axis2/services/StockQuoteService" />
</port>
</service>
Messages are abstract descriptions of information flowing from application to application, and messages are separated from the data format bindings.
<message name="getStockQuoteReq">
<part name="parameters" element="types:getStockQuote" />
</message>
<message name="getStockQuoteResp">
<part name="parameters" element="types:getStockQuoteResponse" />
</message>
Port types, are abstract connections of an operation, which is an abstract description of an action that is supported by the service.
<portType name="StockQuotePortType">
<operation name="getStockQuote">
<input message="tns:getStockQuoteReq" />
<output message="tns:getStockQuoteResp" />
</operation>
</portType>
Bindings are a concrete protocol and data format specification for an instance of a port type.
<binding name="StockQuoteSOAPBinding" type="tns:StockQuotePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="getStockQuote">
<soap:operation style="document" soapAction="getStockQuote" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
A WSDL document is comprised of a number of elements:
-
Type definitions, for data elements (normally using XML Schema).
-
Message definitions, which comprise one or more typed data elements.
-
Operation definitions, which are abstract descriptions of actions supported by the service, and which define what are the input and output messages.
-
PortType definitions, which list the set of operations supported by the Web service.
-
Binding definitions, which describe the binding between the portTypes and protocols (e.g., SOAP or HTTP GET/POST).
-
Service definitions, which list the set of bindings
WSDL has three major elements, according to level of abstraction
nData type definitions
nAbstract operations
nService bindings
Each major element can be specified in a separate XML document and imported in various
combinations to create a final Web services description, or they can all be defined together in a
single document. The data type definitions determine the structure and the content of the
messages. Abstract operations determine the operations performed on the message content, and
service bindings determine the network transport that will carry the message to its destination.
nData types: the data types—in the form of XML schemas or possibly some other
mechanism—to be used in the messages
nMessage: an abstract definition of the data, in the form of a message presented either as
an entire document or as arguments to be mapped to a method invocation
nOperation: the abstract definition of the operation for a message, such as naming a
method, message queue, or business process, that will accept and process the message
nPort type : an abstract set of operations mapped to one or more end points, defining the
collection of operations for a binding; the collection of operations, because it is abstract,
can be mapped to multiple transports through various bindings
nBinding: the concrete protocol and data formats for the operations and messages defined
for a particular port type
nPort: a combination of a binding and a network address, providing the target address of
the service communication
nService: a collection of related end points encompassing the service definitions in the file;
the services map the binding to the port and include any extensibility definitions
WSDL files can be divided into up to three separate, reusable elements
comlete example
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<definitions targetNamespace="http://w3.ibm.com/schemas/services/2002/11/15/stockquote/wsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://w3.ibm.com/schemas/services/2002/11/15/stockquote/wsdl"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:types="http://w3.ibm.com/schemas/services/2002/11/15/stockquote"
>
<import namespace="http://w3.ibm.com/schemas/services/2002/11/15/stockquote" location="StockQuote.xsd" />
<message name="getStockQuoteReq">
<part name="parameters" element="types:getStockQuote" />
</message>
<message name="getStockQuoteResp">
<part name="parameters" element="types:getStockQuoteResponse" />
</message>
<portType name="StockQuotePortType">
<operation name="getStockQuote">
<input message="tns:getStockQuoteReq" />
<output message="tns:getStockQuoteResp" />
</operation>
</portType>
<binding name="StockQuoteSOAPBinding" type="tns:StockQuotePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="getStockQuote">
<soap:operation style="document" soapAction="getStockQuote" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="StockQuoteService">
<port name="StockQuoteSOAPPort" binding="tns:StockQuoteSOAPBinding">
<soap:address location="http://localhost:8080/axis2/services/StockQuoteService" />
</port>
</service>
</definitions>