Extending WSDL





Extending WSDL

There are a couple of ways to extend WSDL beyond what the specification describes and the current state of the art. The first step is to use the open content model defined in the WSDL specification for extending the <binding> section.

It's important that up to the <portType> section, the WSDL document is abstract. Therefore, it doesn't make a lot of sense to extend this section with the open content model. For example, we may want to point to policy information, or even include it in the WSDL, as shown in Listing 10.8.

Listing 10.8 : Pointing to Policy Information in the <binding> Section
<binding name="Service1Soap" type="s0:Service1Soap">
    <soap:binding
      transport="http://schemas.xmlsoap.org/soap/http"
      style="document" />
       <operation name="Add">
           <soap:operation
                 soapAction="http://tempuri.org/Add"
                 style="document"
           />
           <input>
               <sp:servicePolicy
                   xmlns:sp="http://keithba.com/Policies"
                   location="http://localhost/policy"
                />
               <soap:body use="literal" />
           </input>
           <output>
                <soap:body use="literal" />
           </output>
       </operation>
</binding>

This policy element could be useful, for example, in specifying where the client can find the service's policy (such as security requirements), by using a predefined SOAP-based operation for getting this information. Notice also that this extension element was placed within the input message of the operation.

You also could imagine placing this information at the level of the entire operation. And, of course, you also could embed the information into the WSDL itself instead of pointing to a policy endpoint, as in Listing 10.9.

Listing 10.9 : Embedding Policy Information in the <binding> Section
<binding name="Service1Soap" type="s0:Service1Soap">
    <soap:binding
           transport="http://schemas.xmlsoap.org/soap/http"
           style="document" />
       <operation name="Add">
           <soap:operation
                 soapAction="http://tempuri.org/Add"
                 style="document"
           />
           <sec:SecurityPolicy
               xmlns:sec="http://keithba.com/SecurityPolicy">
                 <sec:Encryption level="128" type="DES3">
           </sec:SecurityPolicy>
           <input>
               <soap:body use="literal" />
           </input>
           <output>
                <soap:body use="literal" />
           </output>
       </operation>
</binding>

Notice that this WSDL extension includes specific information, namely, that the service expects the message to be encrypted with triple-DES at 128 bits of encryption. There needs to be a specification somewhere that defines how this WSDL extension works, as well as the specific semantic meaning of these extension elements.


     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows