Friday, October 15, 2010

Modelling WSDL documents as UML

A picture says a thousand words and a UML diagram is definitely the easiest way to understand a SOAP based web-service.
I had blogged about HyperModel a while back, which is the best free tool that I have come across for modelling XML documents as UML. (
I have found it (XmlModelling) immensely useful for understanding Soap-based webservices (such as WCF services) as it breaks down visually the inputs and outputs of an operation and the various data-types and enumerations that the service supports.
Unfortunately there are 2 problems with Hypermodel. 1. Hypermodel hasn’t been updated in a while (last update: 5 July, 2008) – my biggest worry is this awesome tool will just die off and not be updated to support changes to the XML specification. 2: The tool isnt exactly intuitive to use when it comes to modelling WSDL documents.
Here I plan to remedy the 2nd problem:
  1. First you need to download the WSDL documents associated with the web-service. In this case I am going to use this public facing soap-service:
    To do this I am going to use another awesome tool – SoapUI.
    Once installed, you need to import the web-service into SoapUI. After that, right click on the service and select “Export Definition”.
    Image 1
  2. The above step will export the WSDl document. (Note: sometimes the SoapUI file dialog takes a while to become responsive – so be patient). Depending on the WSDL file, you will find that SoapUI exported the wsdl documents as a series of files with the extension .WSDL or .XSD. (note: I found that WCF4 exports a nice set of XSD documents, whereas older versions result in WSDL documents). If the file does not already have a XSD extension, rename the extension. (Hypermodel will only read XSD files).
  3. Start up Hypermodel. (if its your first time starting up Hypermodel, you might have to setup some preferences. Just choose the defaults – as these worked for me).
    Next, open the file menu and select Import XSD.
    Image 2 
  4. The Import XSD command will open the Import XSD Schemas dialog.
    The parent folder is just a way for you to organize your imported XML document. Name it anything you want. The filename, needs to end with .XML, otherwise the Next button will not enable.
    Image 3
    Click Next.
  5. Click next on the next dialog.
    Image 5
  6. If everything ran correctly, you should end up seeing a tree of all the XML objects that were defined in the WSDL document.
    Image 6
  7. You can now select the elements that you need to visualize as UML and select the “Class Dynagram” option from the context menu.
    Image 7
  8. Voila!
    Image 8
You can try generating the UML for the following web-service:
Which should look like this:
List of web-services on which you can try the above steps:

No comments: