blob: 42bf947f36dc4a530266a0e0df0e6cb10d816cc8 [file] [log] [blame]
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta
http-equiv="Content-Type"
content="text/html; charset=UTF-8" />
<meta
http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />
<link
rel="stylesheet"
href="../../../..//default_style.css"
type="text/css" />
<link
rel="stylesheet"
href="../../../..//webtools/wtp.css"
type="text/css" />
<title>WSDL Editor Tutorial</title>
</head>
<body>
<table
width="100%"
cellspacing="5"
cellpadding="2"
border="0">
<tbody>
<tr>
<td
width="60%"
align="left"><font class="indextop">WSDL Editor Tutorial</font> <br />
<font class="indexsub">WSDL Editor Tutorial</font></td>
<td width="40%"><img
width="207"
hspace="50"
height="129"
align="middle"
src="../../../..//webtools/images/wtplogosmall.jpg"
alt="" /></td>
</tr>
</tbody>
</table>
<table
width="100%"
cellspacing="5"
cellpadding="2"
border="0">
<col width="16" />
<col width="*" />
<tbody>
<tr>
<td
valign="top"
align="right">&nbsp;</td>
<td valign="top">
<p><b>By Richard Mah</b> <br />
Created on February 21, 2005<br />
Updated on December 1, 2005<br />
<br />
</p>
<p>In this tutorial we look at using the WSDL Editor to create and modify a WSDL file. We explore the
basic functionality along with some of the more advanced ones.</p>
<p></p>
<div align="right">
<table
border="0"
cellpadding="2"
cellspacing="0"
width="100%">
<tbody>
<tr>
<td
colspan="2"
align="left"
bgcolor="#0080c0"
valign="top"><b><font face="Arial,Helvetica"><font color="#ffffff">New
WSDL Wizard</font></font></b></td>
</tr>
</tbody>
</table>
</div>
<br />
<p></p>
<ol>
<li>Create a new project called "WSDL Example".</li>
<li>Launch the new WSDL Wizard (File --&gt; New --&gt; Other --&gt; XML --&gt; WSDL). Select "WSDL"
under the "XML" folder and click on "Next".</li>
<li>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".</li>
<li>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. (Figure 1).</li>
</ol>
<b>Figure 1</b> <br />
<img
border="0"
src="images/wsdleditor-new-wizard.jpg"
alt="" />
<p>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. <br />
<br />
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. <br />
<br />
For our example, use the default Protocol and Binding options (SOAP Protocol and document literal Binding
Option) and click on "Finish". <br />
<br />
Below we see the generated WSDL skeleton (Graph View).</p>
<b>Figure 2</b> <br />
<img
border="0"
src="images/wsdleditor-new-skeleton.jpg"
alt="" />
<p>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. <br />
<br />
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 --&gt; Binding Input --&gt; Port Type Input --&gt; Part --&gt; XML Schema Element.</p>
<p></p>
<div align="right">
<table
border="0"
cellpadding="2"
cellspacing="0"
width="100%">
<tbody>
<tr>
<td
colspan="2"
align="left"
bgcolor="#0080c0"
valign="top"><b><font face="Arial,Helvetica"><font color="#ffffff">Editing
the WSDL</font></font></b></td>
</tr>
</tbody>
</table>
</div>
<br />
<p></p>
<p><b>1) Renaming WSDL Elements</b> <br />
</p>
<p>Renaming a WSDL Element is done by right-clicking on the element and selecting "Rename".
Alternatively, rename can be done through the properties view. <br />
<br />
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.
(Figure 3).</p>
<b>Figure 3</b> <br />
<img
border="0"
src="images/wsdleditor-smart-rename1.jpg"
alt="" />
<p><b>2) Creating a new WSDL Operation</b> <br />
</p>
<p>To create an Operation, select the Port Type "Employee". Right-click and select "Add Operation". The
Add Operation dialog will appear. See Figure 4</p>
<b>Figure 4</b> <br />
<img
border="0"
src="images/wsdleditor-new-operation.jpg"
alt="" />
<p>The dialog contains the option "Create default messages". Selecting this option will create a new
Operation along with the following associated elements:<br />
</p>
<ul>
<li>Input and Output</li>
<li>Two Messages with one Part each</li>
<li>Two XML Schema Elements. One for each Part</li>
</ul>
<br />
Without the "Create default messages" option selected, only the Opeation along with an input and output will
be created. <br />
<br />
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.
<p></p>
<p><b>3) Editing the Inline Schema</b> <br />
</p>
<p>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:</p>
<ol>
<li>Create a Complex Type by right-clicking in the "Types" group and selecting "Add Complex Type".</li>
<li>Double-click on the Complex Type to drilldown into it.</li>
<li>Rename the Complex Type to "EmployeeInfo".</li>
<li>Right-click on the Complex Type and select "Add Sequence".</li>
<li>Select the newly created sequence and add three Elements by right-clicking and selecting "Add
Element".</li>
<li>Modify the newly created Elements so they appear like Figure 5. <br />
<br />
<b>Figure 5</b> <br />
<img
border="0"
src="images/wsdleditor-complex-type.jpg"
alt="" /> <br />
<br />
</li>
<li>Move up from the Element view to the Schema view using the back <img
border="0"
src="images/wsdleditor-backbutton.jpg"
alt="" /> button located at the top.</li>
<li>Select the Element "EmployeeInfoByIdRequest". In the properties view, change the Type from
"string" to "integer".</li>
<li>Double-click on the Element "EmployeeInfoByIdResponse" to drilldown into the Element.</li>
<li>Rename the Element to "EmployeeInfo".</li>
<li>In the properties view, change the Type from "string" to "EmployeeInfo" and click on "Ok". See
Figure 6 <br />
<br />
<b>Figure 6</b> <br />
<img
border="0"
src="images/wsdleditor-settype-dialog.jpg"
alt="" /> <br />
<br />
</li>
<li>Move up from the Element view to the Schema view using the back button located at the top.</li>
<li>Next, delete the Element "EmployeeInfoByNameResponse". Right-click on the Element and select
"Delete".</li>
<li>Move back from the Schema view to the WSDL view using the back button located at the top.</li>
<li>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" --&gt; "Existing Element..." from the context menu. In the dialog, select the "EmployeeInfo"
Element and click on "Ok". See Figure 7</li>
</ol>
<b>Figure 7</b> <br />
<img
border="0"
src="images/wsdleditor-setelement-dialog.jpg"
alt="" />
<p></p>
<p><b>3) Re-generating the Binding</b> <br />
</p>
<p>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". See Figure 8.</p>
<b>Figure 8</b> <br />
<img
border="0"
src="images/wsdleditor-binding.jpg"
alt="" />
<p>The finished WSDL file is shown in Figure 9.</p>
<b>Figure 9</b> <br />
<img
border="0"
src="images/wsdleditor-finished-wsdl.jpg"
alt="" />
<p>Automatic binding generation is also available. The Bindings will be regenerated to reflect the
changes made to the Port Types when a Save is executed. By default, this option is disabled but may be
turned on via the WSDL Preferences ("Window" --&gt; "Preferences" --&gt; "Web and XML" --&gt; "WSDL Files").
See Figure 10.</p>
<b>Figure 10</b> <br />
<img
border="0"
src="images/wsdleditor-preferences.jpg"
alt="" />
<p>Now that we've finished editing the WSDL, you can save the file.</p>
<p></p>
</td>
</tr>
</tbody>
</table>
</body>
</html>