WSDL im Detail

Das Beispiel aus Listing 1

Die Struktur von WSDL wird am einfachsten verständlich, wenn man sich die einzelnen Einträge in einer WSDL-Datei näher betrachtet. Das Listing 1 zeigt eine sehr einfache Datei. Sie beginnt mit

<?xml version="1.0" encoding="UTF-8"?>

Dieser Eintrag verweist auf die XML-Version – in der Regel 1.0 – und den verwendeten Zeichensatz. Anschließend beginnt die eigentliche Beschreibung des Web Service mit

<wsdl:definitions targetNamespace="urn:DefaultNamespace"

wobei der targetNamespace die URI des Ziel-Namensraums definiert. In der Regel wird hier mit dem DefaultNamespace gearbeitet, wobei anschließend auf die verschiedenen erforderlichen Namespaces verwiesen wird:

xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="urn:DefaultNamespace" xmlns:intf="urn:DefaultNamespace"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/
"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">

Hier kommen beispielsweise die Standard-Namespaces für das Schema sowie SOAP zum Einsatz.In diesem Bereich, der in der Regel automatisch generiert wird, sind normalerweise keine Anpassungen erforderlich.'

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:DefaultNamespace"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="urn:DefaultNamespace" xmlns:intf="urn:DefaultNamespace"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:message name="GETPREISRequest">
<wsdl:part name="REISENUMMER" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="GETPREISResponse">
<wsdl:part name="GETPREISReturn" type="xsd:double"/>
</wsdl:message>
<wsdl:portType name="PreisInfo">
<wsdl:operation name="GETPREIS" parameterOrder="REISENUMMER">
<wsdl:input message="impl:GETPREISRequest"
name="GETPREISRequest"/>
<wsdl:output message="impl:GETPREISResponse"
name="GETPREISResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="DominoSoapBinding" type="impl:PreisInfo">
<wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GETPREIS">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="GETPREISRequest">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:DefaultNamespace" use="encoded"/>
</wsdl:input>
<wsdl:output name="GETPREISResponse">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:DefaultNamespace" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="PreisInfoService">
<wsdl:port binding="impl:DominoSoapBinding" name="Domino">
<wsdlsoap:address location="http://localhost"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>