XMLSPY WSDL Editing


XMLSPY helps you to code SOAP and WSDL in multiple ways, but the two most important ways are SOAP debugging and WSDL editing. Although you could start with SOAP debugging, you need a WSDL file to debug a SOAP server. Therefore, it is better to start editing a WSDL file. The simplest way to edit a WSDL document is to choose File → New and select the WSDL file type from the list box. The resulting XMLSPY IDE state should look similar to Figure 8-1.

click to expand
Figure 8-1: XMLSPY IDE layout after a new WSDL file has been selected.

The WSDL editor is useful, but it requires that you understand WSDL. The way to read this document is to start from the left and read to the right. If you want to edit or update this WSDL graphically, Editing view requires that you right-click to access a menu that describes the operations that can be executed at that location (see Figure 8-2).

The best strategy on coding a WSDL file is to start with a real-life scenario. For example, if you want to create a Math Service, describe the Math Service in either pseudocode or regular code, as in the following example:

public interface MathService {     public int doAdd( int inp1, int inp2);     public int doSubtract( int inp1, int inp2); }

In this interface definition, there are two methods with specific parameters. This interface indicates an RPC type service. The parameter encoding could either be XML Schema or literal. The more appropriate solution would be to be to use an XML Schema because literal encoding is something from the past when there was no XML Schema. The other item to note is that the Web service has four SOAP messages, which are grouped into two sets of input and output messages. There are output messages in this example because both methods return an integer value.

click to expand
Figure 8-2: Right-click the WSDL graphical editor.

The first step is to define the operations. Right-click on the Operations GUI element and select Append Operation To Port Type from the menu. This results in the addition of an item to the Operations box. You rename that item to doAdd, which represents the name of the MathService.doAdd method. Then, right-click this item and select Add Input Element from the menu. Repeat this step, selecting Add Output Element this time. Then repeat the entire process to add the other method doSubtract. The result should look similar to Figure 8-3.

Next, you need to edit the WSDL so that messages are associated with the Operations. The way to add messages is to select the Messages tree control item, right-click, and select Append Message from the menu. The created message represents a SOAP message that is sent. The SOAP message needs parameters, which you can add by right-clicking the newly created message and selecting Add Message Part from the menu. To edit the details of the parameter, select the parameter and look at the Details window on the center right side of the XMLSPY IDE in Figure 8-3. The last step is to associate the messages with the Operations. You do this by dragging and dropping the sub-message item in the Overview window over to the correct Operation method in the Operations window. After the steps just outlined, the XMLSPY IDE should look similar to Figure 8-4.

click to expand
Figure 8-3: The result of editing the operations in the WSDL graphical editor.

click to expand
Figure 8-4: Adding the messages to the WSDL file.

The preceding steps are the hardest part of defining a Web service. The rest involve cross-referencing the already existing created messages with the ports and bindings. You select the Binding from the Overview menu items on the far-right side, and then you associate the PortType to the TypeName port and the style to RPC from the Details list box. In the Services WSDL item, you right-click and create a new service, which is bound to the NewBinding. You create the binding selection by selecting it from the Details window. When all the changes have been made, your Web service should look similar to Figure 8-5.

click to expand
Figure 8-5: Wiring the Web service together.

You can define the rest of the details, such as URI naming, by going through the various details of each item and setting them to the appropriate value. The strategy of building the WSDL incrementally from the message to the service is the strategy that you should use. It is the simplest and most logical when you’re using the XMLSPY WSDL editor. As a practice exercise, go back and cross-reference the WSDL elements defined in the WSDL graphical editor.




The XMLSPY Handbook
The Official XMLSPY Handbook
ISBN: 764549642
EAN: 2147483647
Year: 2001
Pages: 121
Authors: Larry Kim

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net