Home
Editing parts and creating XSD types
WSDL recommends the use of XML Schema Definition (XSD) to define the type of a part. You can use the class diagram to create and edit the required XSD objects such as XSD elements, simple types, or complex types. If you right-click in the class diagram and select Add WSDL you can select the required item from the submenu. Alternatively, you can drag the item from the palette to the class diagram. The wizards involved are similar to the ones described previously in that you specify the WSDL file and enter a name for the XSD object to be created.
If the XSD element added is a complex type, you can add new elements to it. To do this, right-click the complex type and select Add XSD Æ Add New Element. This creates a new element within the selected complex type with type string. You can further set or change the type of an existing XSD element. In the diagram editor, right-click an XSD element or an element within a complex type and select Add XSD Æ Set XSD Type. The dialog that opens provides a list of available types that you can select.
Note that after you have created an XSD element, you can just as easily delete it from the diagram. To delete it permanently from the underlying WSDL file, edit the file directly.
To review or change a type of a part of a WSDL message select the part to bring up its properties in the Properties view, then select the General tab. As shown in Figure | 23, you can select the desired type in the drop-down combo box.
Figure 7-23 Properties view showing the properties of a part
To proceed with this exercise, create two complex types, Account and Customer, and add the attributes amount, name, and firstName as shown in Figure | 24.
Figure 7-24 Complex types with attributes
Finally, link these types to the parts of the messages you have created as shown in Figure | 25.
Figure 7-25 Using XSD complex types as the type for WSDL messages parts
ibm.com/redbooks