WSDL Editor

xml spy
WSDL Editor

XMLSPY 5 Graphical WSDL editor allows you to create, view and edit WSDL documents in a graphical environment similar to the Schema design view.

Special functions:
· Graphical display of all WSDL elements grouped by: operations, PortTypes, Bindings and Services, as well as the actual the WSDL file structure.
· Direct manipulation of WSDL elements using drag and drop.
· Ability to add, append and delete any of the WSDL elements visible in the graphical view (context sensitive menu).
· Ability to enter and edit values, parameters etc. in Details entry helper.
· WSDL validation against W3C Working Draft
· Automatic switch to Schema Design view, if a referenced or imported schema is found to be invalid.
· Editing of schema types in Schema Design view (from within WSDL editor).

Top Next

© 2002 Altova


Overview

Overview

The screenshot below shows the timeservice.wsdl file in the Graphical WSDL editor. This WSDL file is downloaded in the tutorial.

Please note that the project and info windows have both been closed, to show more of the WSDL view. Use the menu item Window | Project window (or Info window) to enable them.

wsdl-overview

Project and info window
The project window display files using the familar tree view, and group files and folders by common extension or any arbitrary criteria. The info window displays detailed information on the currently marked element or attribute in the main window.

Main window
This is where you edit your WSDL and all other XML files. Opening a WSDL file automatically switches you to the Graphical WSDL Editor view. Please note that this view is accessible by clicking the Schema Design view icon. You can, of course, also view a WSDL file in the Enhanced grid and Text view.

If the WSDL file contains a reference to a schema file, then the schema can be viewed by selecting WSDL | Types | Edit schema. This opens the embedded schema file in the Schema Design view. The schema has to be saved (or closed) for you to be able to change the view of the underlying WSDL file (and, continue working in the WSDL file).

Please see Main window components for an in-depth explanation of the Operations, PortTypes, Bindings and Services windows.

Overview window (entry helper)

wsdl-entryh-overvw
The Overview entry helper displays the components of the WSDL file exactly as they appear in the underlying text file (click the Text file icon to display it). Clicking the expand icon allows you to see the sub elements. The Details entry helper allows you to view and edit parameters directly.

Details window (entry helper)

wsdl-entryh-details
The Details entry helper displays the parameters of the currently marked item in either the Main or Overview windows. You can directly enter and edit parameters in this window.

Previous Top Next

© 2002 Altova


Main window components

Main window components

Operations

wsdl-tut-main-oper
This window displays all of the operations for each of the existing portTypes. The operations associated with a portType, are graphically represented by a connector (line) to the PortType window.

Clicking the expand icon "+", of an operation, displays the input and output messages. If a message consists of several parts, then clicking the expand icon will display the part parameters. Please note that the Details window also displays the part details, and allows you to enter and edit parameters directly.

Right clicking in the Operations window opens a context sensitive menu. You can append, insert, or delete operations, as well as add Input and Output messages, to a specific operation.

PortTypes

wsdl-main-porttype
The PortType window displays all the portTypes of the WSDL file and is graphically linked to the collection of Operations for the specific service. Clicking in the portType window, highlights all the associated operations in the Operations window. Each portType is also graphically linked to the associated binding in the Bindings window.

Right clicking the PortType window rectangle, opens a context sensitive menu. You can Append or Delete the PortType, as well as append an Operation to it.

Bindings

wsdl-main-bind
The Bindings window displays the bindings for each of the operations associated with a specific portType and displays all relevant parameters in the Details window:

· The Name attribute, which is user defined
· The (port)Type attribute, which refers to the specific portType
· The type of binding, SOAP, http/GET or http/POST
· The Transport attribute, which defines the transporturi to use, and the
· Style attribute, which can be rpc or document
The SOAP action has to be defined for each operation, as well as the input and output encoding.

Right clicking on a specific item opens a context sensitive menu. Bindings can be appended or deleted; extensibility items can be added or deleted to Input or Output messages.

Services

wsdl-main-service
The Services window displays the currently defined web services. The Details window displays the Service name, binding and actual service location, and allows you to enter or edit these data directly.

Right clicking a specific item in the Services window opens a context menu. Services can be appended or deleted; while ports can be appended to, or deleted from, a service.


WSDL Tutorial

WSDL Tutorial

The aim of this tutorial is to:
· Create a WSDL file from scratch in the graphical WSDL view
· Connect to a web service, save the WSDL file locally, and send a SOAP request to the web service

The graphical nature of the WSDL editor allows you to do all this without having to use the Text view. You can directly manipulate the WSDL components using drag and drop, as well as enter the necessary parameters in the entry helpers.

This will be achieved by:
· Using the File | New menu option to create a skeleton WSDL file.
· Associating ports to the service
· Associating a connection address to a binding
· Adding Input and Output messages, as well as their associated parameters
· Adding messages to operations
· Defining the binding type
· Validating the WSDL file, to check its status, and using any resulting prompts to help complete the WSDL file


Create a Service and Port

Create a Service and Port

Creating a Service and an associated Port:
1. Select File | New, select the WSDL Web Service Description Language entry and confirm with OK.

wsdl-tut-newserv1

This creates a skeleton WSDL file which automatically opens in the graphical WSDL view.
2. Click the serviceName entry in the Services window, and change it to a service name of your choice, e.g. MyService (or click the entry, hit F2, then enter the new name).
3. Right click MyService, and select the Append Port entry from the popup menu.
This adds a NewPort entry to the Services window.
4. Click the NewPort entry and rename it, e.g. MyPort.

wsdl-tut-newserv2

5. While the MyPort entry is active, double click the Location field of the Details entry helper, and enter the connection address of this service e.g. http://myaddress.com.

wsdl-tut-newserv3

6. In the Overview window, click the typeName entry under PortTypes, and rename it to SOAPport in the name field of the Details entry helper.

wsdl-tut-newserv4

This changes the PortType name in all associated PortType windows.

wsdl-tut-newserv5

Associating a connection Address to a Binding (defining an operation for a PortType):
1. While the MyPort entry is active, click the binding combo box in the Details entry helper, and select the supplied entry (y:bindingName).

wsdl-tut-newserv6

2. Right click the PortTypes window, and select Append Operation to this PortType.

wsdl-tut-newserv7

This creates a new operation in the Operations window, and also automatically adds the operation to the current binding in the Bindings window.

wsdl-tut-newserv8


Adding Input, Output messages and Parameters

Adding Input, Output messages and Parameters

Adding Input and Output messages to an operation:
1. Right click the NewOperation item in the Operations window, and select Add Input element.

wsdl-tut-addinput1

2. Right click the Input: entry, and select Add new Message to this element.

wsdl-tut-addinput2

This automatically adds "y:NewMessage" to the input entry.

wsdl-tut-addinput3

3. Click the NewOperation entry and rename it e.g. EchoString.
4. Using the Overview entry helper, click NewMessage and rename it, e.g. EchoStringRequest.

wsdl-tut-addinput4

This also automatically renames it in the Operations window.

wsdl-tut-addinput5

Adding Parameters to messages:
1. Right click the EchoStringRequest in the Overview entry helper, and select Add Message Part (Parameter).
This adds a parameter to the EchoStringRequest.

wsdl-tut-addinput6

2. Click the newly added message part (in the Overview window) and rename it e.g. String.
3. Use the type combo box in the Details entry helper, and enter or select xs:string.

wsdl-tut-addinput7

The updated parameter part also appears in the Operations window.

Assigning messages to operations: (alternative method)
1. Right click the EchoString operation in the Operations window, and select Add Output element.

wsdl-tut-addinput8

This adds an Output: message to EchoString.
2. In the Overview entry helper, right click the messageName entry, and hit F2 (rename).

wsdl-tut-addinput9

3. Rename the message entry e.g. "EchoStringResponse".

wsdl-tut-addinput9a

4. Right click the entry and select Add message Part (parameter).

wsdl-tut-addinput9b

5. Click the EchoStringResponse entry, drag it to the Operations window, and drop it on the Output: entry.

wsdl-tut-addinput9c

The expand icon appears next to the Output: entry. Click it to expand the view.

wsdl-tut-addinput9d

6. Click the parameter entry in the Overview entry helper, and use the type combo box in the Details entry helper, to enter or select xs:string.

wsdl-tut-addinput9e

Defining the binding type:
1. Click the bindingName entry in the Bindings window, then click the type of binding combo box in the Details entry helper, and select SOAP.

wsdl-tut-addinput9f

This adds a soap:Body entry to the Input and Output messages in the Bindings window.

wsdl-tut-addinput9g

2. Click the soap:Body entry of the Input message (in the Bindings window), click the use combo box in the Details entry helper, and select "literal". Do the same for the Output message.

wsdl-tut-addinput9h


Validating and finishing up

Validating and finishing up

Validating the WSDL file:
The WSDL graphical editor incorporates a WSDL validator. Hitting the F8 key validates against the W3C WSDL Working Draft.

1. Select the menu option XML | Validate, or hit the F8 key.
A message appears stating the bindingName style attribute has to be defined.

wsdl-tut-valid1

2. With the bindingName entry active, click the style combo box in the Details entry helper, and select "rpc".
3. Hit F8 again to validate the WSDL file.
A message appears stating the transporturi attribute has to be defined.
4. Double click the transporturi field in the Details entry helper, and enter the uri e.g. http://schemas.xmlsoap.org/soap/http.

wsdl-tut-valid2

5. Hit F8 to validate the file.
The "File is valid" message appears. You could now use the WSDL file as the basis of a webservice.

Final WSDL file in the Graphical WSDL view:

wsdl-tut-valid3

Final WSDL file in Text view:

wsdl-tut-valid4


Connecting to a web service and copying the WSDL file

Connecting to a web service and copying the WSDL file

1. Activate the Project window if it is not visible, using the menu option Window | Project window.
2. Click the expand icon next to the SOAP Debugger folder, and double click the DebuggerClient.htm file.
This opens the SOAP Debugger Example Client in the main window.

wsdl-tut-tserv2

3. Select the menu option File | Open URL... and enter/copy the http://www.nanonull.com/TimeService/TimeService.asmx?WSDL entry, into the File URL field of the Open URL dialog box.

wsdl-tut-tserv3

4. Click OK to load the WSDL file.
The WSDL file is displayed in the Enhanced Grid view (click the definitions bar to see more of the WSDL file).

wsdl-tut-tserv4

5. Select the menu option File | Save As..., and save the file locally, e.g. naming it timeservice.wsdl.
6. Click the Schema Design view icon to display the file in the Graphical WSDL editor.

wsdl-tut-tserv5

Viewing the schema file associated with the active WSDL file:
With the timeservice.wsdl file as the active document in the main window:

1. Select the menu option WSDL | Types | Edit Schema(s).
2. This opens the wsdlschema.xsd file in the main window.

wsdl-tut-schema1

The schema file supplies/defines all the datatypes used in the timeservice.wsdl file.

Please note:
You can click the associated WSDL file at any time, but once it is active you cannot change the view it is displayed in i.e. into Enhanced grid or Text view. An error message appears at this point. You have to switch back to the schema file and close it before changing the view of the WSDL file.


Sending a SOAP request from the WSDL file

Sending a SOAP request from the WSDL file

Sending a SOAP request from the WSDL file:
With the timeservice.wsdl file as the active file in the main window,

1. Select the menu option SOAP | Send new SOAP request.
2. Click the Window... button to select the currently active WSDL file, and confirm with OK.
Select a SOAP operation name from the dialog box, e.g. getServerTime, and click OK.

wsdl-tut-soap1

This creates a SOAP request document containing the getServerTime operation.

wsdl-tut-soap2

3. Select the menu option SOAP | Send request to server.
The SOAP response document appears in the main window, containg the element getServerTimeResult, displaying the current server time of the Nanonull.com time service.

wsdl-tut-soap3

Previous Top

© 2002 Altova