Tools Guide  

Chapter 8   WSDL Editor

The WSDL Editor provides a quick and easy way to create, edit, and view WSDL documents. This chapter contains the following topics:

 
Top of page

About WSDL

WSDL (Web Services Description Language) is a general-purpose XML vocabulary for describing Web Services. Using WSDL, it is possible to describe (concisely and in a standardized manner) the interface, protocol bindings, and deployment details of Web-based services, at a level of detail sufficient for businesses to begin to interact online.

    The complete WSDL standard can be found at http://www.w3.org/TR/wsdl.

 
Top of page

About the WSDL Editor

The WSDL Editor lets you:

The WSDL Editor also supports the editing features described in Chapter 6, "Source Editors".

 
Top of page

Creating a new WSDL document

To create a new WSDL document:

  1. Select File>New.

  2. On the Web Services tab, select WSDL and click OK.

    The WSDL Wizard displays.

  3. (Optional) Enter a Definition Name.

  4. (Optional) Enter a Target Namespace. This can be the Uniform Resource Name associated with this WSDL document. You cannot specify a relative URN.

  5. (Optional) In the Documentation text box, enter any human-readable comment or descriptive language you would like to associate with the definition element.

  6. Select the Include WSDL template check box if you want a skeleton document to be created for you using values provided in this wizard. Leave the check box unselected to start with a blank document.

  7. Click Finish.

    A new WSDL document opens in the WSDL Editor.

 
Top of page

Adding elements to a WSDL document

WSDL documents can contain four standard element types: message, port type, binding, and service. These element types build on one another with cascading references; so when you create a WSDL file, you should create the message section first, followed by the port type section, then the binding section, and finally the service section.

The WSDL Editor offers dialog-based assistance in creating each of the four types.

 
Top of section

Adding a message element

In WSDL, a message is an abstract definition of the data being exchanged.

To add a message element to a WSDL document:

  1. Position the insertion point where you want to insert the definition and right-click.

    A popup menu displays.

  2. Select Insert WSDL Element>Message.

  3. Specify the following information in the Message dialog:

    Option

    What to do

    Name

    Specify the value of the name attribute of the <message> element.

    Documentation

    (Optional) Specify any human-readable comment or descriptive language you would like to associate with this message.

    Parts

    Specify this information for each <part> element of your message:

    • The name attribute

    • The typing value (Element or Type)

    • Under Value, the element attribute

    To add another part entry to the message, click Add. To remove an entry, select the entry and click Delete.

  4. Click OK.

    A new message section is added to your document.

      <message name="GetLastTradePriceOutput">
         <part name="body" element="xsd1:TradePriceResult"/>
      </message>
    

 
Top of section

Adding a port type element

A WSDL port type is an abstract definition of the operations supported by a service and the communications mode (one-way, request-response, and so on) that will be used in the service.

To add a port type to a WSDL document:

  1. Position the insertion point where you want to insert the definition and right-click.

    A popup menu displays.

  2. Select Insert WSDL Element>Port Type.

  3. Specify the following information on the Port Type dialog:

    Option

    What to do

    Name

    Specify the value of the name attribute of the <portType> element.

    Documentation

    (Optional) Specify any human-readable comment or descriptive language you would like to associate with this port type.

    Operations

    Specify this information for each <operation> element of your port type:

    • The name attribute

    • The type (One-way, Request-response, Solicit-response, or Notification)

    • Under Formats, click the Define button to specify the operation's messages using the Define dialog

      The dialog has several control groups. Only those that are appropriate to the type of operation are enabled. For example, if you chose Notification as the type, only the Output control group is enabled. For each enabled group, you must specify a Name and Message appropriate to the operation for Input and Output. Specifying values for the Fault group is optional.

    To add another operation entry to the port type, click Add.
    To remove an entry, select the entry and click Delete.

  4. Click OK.

    A new port type section is added to your document.

      <portType name="StockQuotePortType">
         <operation name="GetTradePrice">
            <input name="input" message="tns:GetLastTradePriceInput"/>
            <output name="output" message="tns:GetLastTradePriceOutput"/>
         </operation>
      </portType>
    

 
Top of section

Adding a binding element

A WSDL binding specifies concrete protocol and data format specifications for the operations and messages defined by a particular port type.

To add a binding to a WSDL document:

  1. Position the insertion point where you want to insert the definition and right-click.

    A popup menu displays.

  2. Select Insert WSDL Element>Binding.

  3. Specify the following information on the Binding dialog:

    Option

    What to do

    Name

    Specify the value of the name attribute of the <binding> element.

    Documentation

    (Optional) Specify any human-readable comment or descriptive language you would like to associate with this binding element.

    Port Type

    Specify the port type for this binding. The dropdown list displays the names of the port types that you have created for this document (see Adding a port type element).

    SOAP Binding

    If your WSDL document will specify a SOAP binding, select SOAP Binding, then select a Style (RPC or Document) and specify a Transport value.

    HTTP Binding

    If an HTTP binding will be used, select HTTP Binding and enter the appropriate Verb (GET or POST).

    User Defined

    Select if you want to specify a custom binding protocol manually.

  4. Click OK.

    A new binding section is added to your document.

      <binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType">
         <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
         <operation name="GetLastTradePrice">
            <soap:operation soapAction="http://example.com/GetLastTradePrice"/>
            <input>
               <soap:body use="literal" namespace="http://example.com/stockquote.xsd
               encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
               <soap:body use="literal" namespace="http://example.com/stockquote.xsd"
               encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
         </operation>
      </binding>
    

 
Top of section

Adding a service element

A WSDL service names the entry-point address (or addresses) for the Web Service in question. These addresses are in the form of URIs and constitute ports.

To add a service to a WSDL document:

  1. Position the insertion point where you want to insert the definition and right-click.

    A popup menu displays.

  2. Select Insert WSDL Element>Service.

  3. Specify the following information on the Service dialog:

    Option

    What to do

    Name

    Specify the value of the name attribute of the <service> element

    Documentation

    (Optional) Specify any human-readable comment or descriptive language you would like to associate with this service.

    Ports

    Specify this information for each <port> element of your service:

    • The name attribute

    • The binding value; the dropdown list displays the names of the bindings you have created for this document (see Adding a binding element)

    • The address type (None, SOAP, or HTTP)

    • The location (the URI by which your service will be available)

    To add another port entry to the service, click Add.
    To remove an entry, select the entry and click Delete.

  4. Click OK.

    A new service entry is added to your document.

      <service name="StockQuoteService"> 
         <port name="StockQuotePort" binding="tns:StockQuoteBinding">
            <soap:address location="http://example.com/stockquote"/> 
         </port> 
      </service> 
    

 
Top of page

Validating a WSDL document

When a WSDL document is displayed in the Edit Pane, you can validate the document by clicking the Validate button (which looks like a check mark) in the toolbar. If the document is validated, you see this dialog:

Otherwise, you see a dialog giving information identifying the malformed statement(s) in the document.

CAUTION   You should carefully review your WSDL even if the document validation is successful. The W3C WSDL specification allows for extensibility elements throughout all levels of a WSDL document. So if you build the document without using the dialogs or do a lot of cut-and-paste from other sources, it is possible that the document will test as valid but not be what you want.

 
Top of page

Displaying a stylized view

By default, WSDL documents are displayed in a color-coded text-edit view—the normal view for working on WSDL documents. You can also display a stylized view of WSDL documents, created by applying an XSL style sheet to your document. The WSDL Editor comes with two built-in style sheets: Summary and Detail.

To display a stylized view of a WSDL document:

  1. Open the WSDL document.

  2. Click the Stylized tab at the bottom of the WSDL Edit Pane.

    The view changes to stylized.

    In this example, the Summary style sheet has been applied to the document.

To choose a different style for the stylized view:

  1. With the Stylized tab selected, right-click in the WSDL Edit Pane.

    A popup menu displays.

  2. Select an item from the Stylesheets submenu:

 
Top of page

Publishing to a registry

When you have created a WSDL document, you can publish it to a registry.

    For more information, see "Publishing to a registry" on page 285.

 
Top of page

Generating Web Service files from WSDL

A WSDL document describes a Web Service. You can invoke the Web Service Wizard from the WSDL Editor to generate the Java classes needed to implement or consume that Web Service.

To generate Java classes:

  1. Make sure a Workbench project is open.

  2. Open the WSDL document in text view.

  3. Click the Generate Java Class button.

    The Web Service Wizard is invoked.

    For more information, see Chapter 5, "Web Service Wizard".

   

Tools Guide  

Copyright © 2002, SilverStream Software, Inc. All rights reserved.