View on GitHub

Devendra's Log

A WSDL with alternate schema for extensibility

This post presents a SOAP WSDL in the document/literal style, using qualified elements from an alternate schema to support extensibility.

The SOAP request described by the WSDL looks like

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:echo="http://echo" xmlns:alt="http://alternate">
   <soapenv:Header>
      <echo:SessionId>?</echo:SessionId>
   </soapenv:Header>
   <soapenv:Body>
      <echo:Echo>
         <alt:message>?</alt:message>
      </echo:Echo>
   </soapenv:Body>
</soapenv:Envelope>

The SOAP response looks like

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:echo="http://echo" xmlns:alt="http://alternate">
   <soapenv:Header>
      <echo:SessionId>?</echo:SessionId>
   </soapenv:Header>
   <soapenv:Body>
      <echo:EchoResponse>
         <alt:message>?</alt:message>
      </echo:EchoResponse>
   </soapenv:Body>
</soapenv:Envelope>

The standalone WSDL file is shown in listing example-standalone.wsdl.

The alternate schema can be in a separate file, as shown in listing alternate.xsd. A WSDL file that uses the schema file is shown in listing example.wsdl. Note the use of import element from wsdl namespace.