Herong's Tutorial Notes on Web Service and SOAP
Dr. Herong Yang, Version 4.00

Downloading and Editing WSDL Document

This section provides a tutorial example on how to download the WSDL document from the Web service provider. You can change port.address[@location] to a localhost URL to local testing.

In order to help me troubleshooting my SOAP::Lite WSDL program, I downloaded the GetSpeech WSDL document to my local system.

1. Go to http://www.xmlme.com/WSShakespeare.asmx?WSDL with a Web browser. Wait for the WSDL document to show up.

2. Right mouse click on the document and select "View page source" from the context pop up menu.

3. Click "File" > "Save page as" and save the file as \herong\GetSpeech.wsdl.

4. Open \herong\GetSpeech.wsdl in a text editor and change port.address[@location] to localhost URLs. This will allow me to test my SOAP::Lite program locally.

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
  xmlns:tns="http://xmlme.com/WebServices"
  xmlns:s="http://www.w3.org/2001/XMLSchema"
  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
  targetNamespace="http://xmlme.com/WebServices"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
     This Web Service takes a phrase from the plays of William ...
  </wsdl:documentation>
  <wsdl:types>
    <s:schema elementFormDefault="qualified"
      targetNamespace="http://xmlme.com/WebServices">
      <s:element name="GetSpeech">
         ...
      </s:element>
      <s:element name="GetSpeechResponse">
         ...
      </s:element>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="GetSpeechSoapIn">
    <wsdl:part name="parameters" element="tns:GetSpeech" />
  </wsdl:message>
  <wsdl:message name="GetSpeechSoapOut">
    <wsdl:part name="parameters" element="tns:GetSpeechResponse" />
  </wsdl:message>
  <wsdl:portType name="ShakespeareSoap">
    <wsdl:operation name="GetSpeech">
      ...
      <wsdl:input message="tns:GetSpeechSoapIn" />
      <wsdl:output message="tns:GetSpeechSoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="ShakespeareSoap" type="tns:ShakespeareSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="GetSpeech">
       ...
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="ShakespeareSoap12" type="tns:ShakespeareSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="GetSpeech">
       ,,,
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="Shakespeare">
    ...
    <wsdl:port name="ShakespeareSoap" binding="tns:ShakespeareSoap">
      <soap:address location="http://localhost/soap11" />
    </wsdl:port>
    <wsdl:port name="ShakespeareSoap12"
      binding="tns:ShakespeareSoap12">
      <soap12:address location="http://localhost/soap12" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Note that there are two "port"s defined in the WSDL: one for SOAP 1.1 and one for SOAP 1.2.

Last update: 2009.

Sections in This Chapter

First WSDL Test Failed with SOAP::Lite

Downloading and Editing WSDL Document

Testing service() Function Locally

soapversion('1.2') Sets Correct Envelope namespace

Error: Object reference not set to an instance of an object

Dr. Herong Yang, updated in 2009
Downloading and Editing WSDL Document