# Authoring WSDL with the WSDL Editor

In this tutorial we will look at using the WSDL Editor to create and modify a WSDL file. We will explore the basic and more advanced functionality of the WSDL editor.

## The New WSDL Wizard

1. Create a new project called "WSDL Example".
2. Launch the new WSDL Wizard (File --> New --> Other --> XML --> WSDL). Select "WSDL" under the "XML" folder and click on "Next".
3. Enter "Employee.wsdl" as the name for the WSDL file and select "WSDL Example" as the project where the WSDL should be created. Click on "Next".
4. The first two fields of the "Options" dialog page are used to set the target namespace and prefix of the WSDL. For our example, use the default values.

The next option is the "Create WSDL Skeleton". If this option is selected, the wizard will create a simple WSDL skeleton from which we can quickly modify the WSDL as we see fit. We will discuss the contents of the generated skeleton below.
If the "Create WSDL Skeleton" is selected, we are presented with additional options to configure. The first is the protocol. From this dropdown menu we can select either the SOAP or HTTP protocol. Next are the Binding Options. The choices listed here will depend on the protocol selected. Only Binding Options which apply to the selected protocol will be displayed. The Protocol and Binding Options selected here will be used to generate the Binding for the WSDL Skeleton.
For our example, use the default Protocol and Binding options (SOAP Protocol and document literal Binding Option) and click on "Finish".
Below we see the generated WSDL skeleton (Graph View).

The graph view above displays the WSDL in an easy to read format. The view is divided into several groups with each containing instances of that particular element.
Selecting a WSDL element in the graph view also shows it's relationship to the other elements by connecting arrow lines. For example, if we select "NewOperationRequest" Part (Figure 2), arrow lines will be drawn from the Port --> Binding Input --> Port Type Input --> Part --> XML Schema Element.

## Editing the WSDL Document

1. Renaming WSDL Elements

   Renaming a WSDL Element is done by right-clicking on the element and selecting "Rename". Alternatively, rename can be done through the properties view.
   For our example, rename the Operation "NewOperation" to "EmployeeInfoById". Notice the multiple renamings which occur. The Operation is renamed along with it's associated Messages, Parts, and XML Schema Elements.

2. Creating a new WSDL Operation

   To create an Operation, select the Port Type "Employee". Right-click and select "Add Operation". The Add Operation dialog will appear.

   The dialog contains the option "Create default messages". Selecting this option will create a new Operation along with the following associated elements:

   - Input and Output
   - Two Messages with one Part each
   - Two XML Schema Elements. One for each Part
   Without the "Create default messages" option selected, only the Opeation along with an input and output will be created.
   For our example, select the "Create default messages" option and type in "EmployeeInfoByName" as the name. Click on "Ok". Notice the names used for the newly created WSDL and XML Schema objects.
3. Editing the Inline Schema

   We shall use the XML Schema View to modify the inline schema. In the "Types" group, double-click on the inline schema. The XML Schema View will appear showing four XML Schema Elements. Follow the steps below to edit the XML Schema:

   1. Create a Complex Type by right-clicking in the "Types" group and selecting "Add Complex Type".
   2. Double-click on the Complex Type to drilldown into it.
   3. Rename the Complex Type to "EmployeeInfo".
   4. Right-click on the Complex Type and select "Add Sequence".
   5. Select the newly created sequence and add three Elements by right-clicking and selecting "Add Element".
   6. Modify the newly created Elements so they appear as they do in the figure below.
   7. Move up from the Element view to the Schema view using the back button located at the top.
   8. Select the Element "EmployeeInfoByIdRequest". In the properties view, change the Type from "string" to "integer".
   9. Double-click on the Element "EmployeeInfoByIdResponse" to drilldown into the Element.
   10. Rename the Element to "EmployeeInfo".
   11. In the properties view, change the Type from "string" to "EmployeeInfo" and click on "Ok".
   12. Move up from the Element view to the Schema view using the back button located at the top.
   13. Next, delete the Element "EmplyeeInfoByNameResponse". Right-click on the Element and select "Delete".
   14. Move back from the Schema view to the WSDL view using the back button located at the top.
   15. We must now modify "EmployeeInfoByIdResponse" and "EmployeeInfoByNameResponse" Parts to reference the renamed XML Schema Element "EmployeeInfo". Right-click on the Part and select "Set Element" --> "Existing Element..." from the context menu. In the dialog, select the "EmployeeInfo" Element and click on "Finish".
4. Re-generating the Binding

   The last step required is the re-generation of the Binding. The Binding was originally based on the Operation generated by the wizard. But since then we have modified and created a brand-new Operation. Right-click on the "EmployeeSOAP" Binding and select "Generate Binding Content...". Select the "Overwrite existing binding information" option and click-on "Finish".

   The finished WSDL file is shown below.

   Now that we've finished editing the WSDL, you can save the file.