|
Tools Guide |
The WSDL Editor provides a quick and easy way to create, edit, and view WSDL documents. This chapter contains the following topics:
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.
Create and edit WSDL documents (files with the .WSDL extension)
Easily create any of the four canonical WSDL document elements (message, port type, binding, or service)
View WSDL documents in stylized view and color-coded text view
The WSDL Editor also supports the editing features described in Chapter 6, "Source Editors".
To create a new WSDL document:
On the Web Services tab, select WSDL and click OK.
The WSDL Wizard displays.
(Optional) Enter a Target Namespace. This can be the Uniform Resource Name associated with this WSDL document. You cannot specify a relative URN.
(Optional) In the Documentation text box, enter any human-readable comment or descriptive language you would like to associate with the definition element.
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.
A new WSDL document opens in the WSDL Editor.
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.
In WSDL, a message is an abstract definition of the data being exchanged.
To add a message element to a WSDL document:
Position the insertion point where you want to insert the definition and right-click.
A popup menu displays.
Select Insert WSDL Element>Message.
Specify the following information in the Message dialog:
A new message section is added to your document.
<message name="GetLastTradePriceOutput"> <part name="body" element="xsd1:TradePriceResult"/> </message>
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:
Position the insertion point where you want to insert the definition and right-click.
A popup menu displays.
Select Insert WSDL Element>Port Type.
Specify the following information on the Port Type dialog:
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>
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:
Position the insertion point where you want to insert the definition and right-click.
A popup menu displays.
Select Insert WSDL Element>Binding.
Specify the following information on the Binding dialog:
|
Option |
What to do |
|---|---|
Specify the value of the name attribute of the <binding> element. | |
(Optional) Specify any human-readable comment or descriptive language you would like to associate with this binding element. | |
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). | |
If your WSDL document will specify a SOAP binding, select SOAP Binding, then select a Style (RPC or Document) and specify a Transport value. | |
If an HTTP binding will be used, select HTTP Binding and enter the appropriate Verb (GET or POST). | |
Select if you want to specify a custom binding protocol manually. |
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>
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:
Position the insertion point where you want to insert the definition and right-click.
A popup menu displays.
Select Insert WSDL Element>Service.
Specify the following information on the Service dialog:
|
Option |
What to do |
|---|---|
Specify the value of the name attribute of the <service> element | |
(Optional) Specify any human-readable comment or descriptive language you would like to associate with this service. | |
Specify this information for each <port> element of your service:
To add another port entry to the service, click Add. |
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>
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.
By default, WSDL documents are displayed in a color-coded text-edit viewthe 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:
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:
With the Stylized tab selected, right-click in the WSDL Edit Pane.
A popup menu displays.
Select an item from the Stylesheets submenu:
Details provides a detail-oriented plain-text view of the WSDL document (with no XML tags)
Custom opens a dialog that allows you to choose your own XSL style sheet for rendering a custom view, and/or setting a default style sheet
Choose one of the following:
TIP You can optionally select the Set as default check box to apply the style sheet you've chosen as the default in stylized views. Your preference will persist across Workbench sessions.
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.
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.
For more information, see
Chapter 5, "Web Service Wizard".
|
Tools Guide |
Copyright © 2002, SilverStream Software, Inc. All rights reserved.