Section 14.11. What is WSDL?


14.11. What is WSDL?

While SOAP is used as the format of the exchanged message, WSDL is used to describe the callable web service. WSDL is the XML vocabulary for describing web services, where they are located, and how they can be called. Using the WSDL description of a web service, we can code a client typically with at least some code generation to reduce the amount of hand coding that must be done.

WSDL documents describe the what, how, and where of web services, as illustrated in the simplified WSDL document shown in Figure 14-8. First, consider the what. A port type describes the abstract interface, which is the web service to be called. A port type can have one or more operations. An operation describes the functionality to be called, and the input, output, and fault message types associated with it. The different messages are built from built-in or custom data types. The data types themselves are defined using the XSD language.

To describe how to call a web service, a binding specifies the transport protocol for exchanging messages, such as HTTP, HTTPS, SMTP, FTP, and so on. The service can be bound to multiple protocols if the service provider can accept them. Finally, a WSDL port details the specific network address at which the service can be found.

Example 14-2 shows an actual WSDL document for a GetAddress function.

Figure 14-8. A simplified WSDL document


Example 14-2. A WSDL file

 <?xml version="1.0" encoding="utf-8"?> <wsdl:definitions    targetNamespace="http://sap.com/demo/WS/GetAddress/prepared"    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"    xmlns:tns="http://sap.com/demo/WS/GetAddress/prepared"    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"    xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <wsdl:types> <!-- XSD schema types shown in Example 14-1 --> </wsdl:types> <wsdl:message name="Request_Message"> <wsdl:part name="parameters" element="tns:Request_Message"/> </wsdl:message> <wsdl:message name="Response_Message"> <wsdl:part name="parameters" element="tns:Response_Message"/> </wsdl:message> <wsdl:portType name="Z_WS_Address_Test"> <wsdl:operation name="Z_Get_Address"> <wsdl:input message="tns:Request_Message"/> <wsdl:output message="tns:Response_Message"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="Z_WS_Address_TestSoapBinding"               type="tns:Z_WS_Address_Test"> <soap:binding style="document"               transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="Z_Get_Address"> <soap:operation soapAction=""/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="Z_WS_Address_TestService"> <wsdl:port name="Z_WS_Address_TestSoapBinding"            binding="tns:Z_WS_Address_TestSoapBinding"> <soap:address    location=    "http://iwdfvm1035.wdf.sap.corp:8000/Z_WS_ADDRESS_TEST?sap-client=100"/> </wsdl:port> </wsdl:service> </wsdl:definitions>

The WSDL file describes the web service: how to format the messages that will be exchanged to implement the service and the network location for accessing the service.




Enterprise SOA. Designing IT for Business Innovation
Enterprise SOA: Designing IT for Business Innovation
ISBN: 0596102380
EAN: 2147483647
Year: 2004
Pages: 265

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net