Skip to main content

Build Eclipse plug-ins to extend Rational Software Architect UML to WSDL transformations

Step by step guidelines on how to build plug-ins which extend the Rational Software Architect transformation feature

Sefa Sevtekin (sevtekin@us.ibm.com), Senior IT Specialist, IBM
author photo
Sefa Sevtekin is a senior solution architect in IBM Rational Software Services Group. He's been working with customers on implementing Model Driven Achitecture (MDA) using IBM Rational Tooling.He has delivered various international seminars, workshops, techinal articles, customer trainings, and consulting services.

Summary:  This article walks you through the steps to extend the IBM Rational Software Architect UML-to-WSDL transformation feature by customizing the bindings.

Date:  05 May 2009
Level:  Advanced
Activity:  746 views

The structure of the output that the UML-to-WSDL transformation generates depends on the structure of the UML source model. The IBM® Rational® Software Architect UML-to-WSDL transformation uses the bindings to generate Web Service Description Language (WSDL) files. The specific steps are described here.

Prerequisites

To follow the steps, you need to understand the Java™ programming model, Eclipse plug-in architecture and development, and IBM Rational Software Architect transformation authoring concepts. The steps described in this article are performed using IBM Rational Software Architect Version 7.

The Rational Software Architect UML-to-WSDL transformation uses the bindings to generate Web Service Description Language (WSDL) files. These are the main steps for customizing the bindings:

  1. Import an existing UML project with predefined UML elements by using the project interchange capability. Run the UML-to-WSDL transformation to generate the WSDL file. Save and export the project by using the project interchange mechanism. You will use this project later to test the transformation and compare the generated WSDL files.

  2. Create a plug-in project to create the transformation extension.

  3. Add a set of required plug-in dependencies. These plug-ins define the extension point that you are implementing and provide the APIs that you will need to invoke your extension.

  4. Define the extension point in the plug-in descriptor, which identifies the transformation that you want to extend and the point within it that you want to make a contribution.

  5. Provide Java implementations of the rules that will be invoked each time the transformation encounters the element types that you registered.

  6. Test the transformation by invoking a runtime workbench and executing the transformation. You will need to import the UML project that you exported earlier and run the UML-to-WSDL transformation to observe the behavior and effect of the transformation extension that you created.

When you run the transformation, it will also execute the rules that you defined in your transformation extension. As a result, it will change the WSDL binding to SOAP binding.


Import the project interchange

In this task, you will import the UML project and run the UML-to-WSDL transformation. Then you will save and export the UML project.

  1. Launch Rational Software Architect.

  2. Switch to the Modeling perspective.

  3. Select File > Import.

  4. In the Import dialog, replace "type filter text" with project. Then select Project Interchange under Other.


Figure 01. Select Project Interchange as the import type
'Select an import source' field says 'project'


  1. Click Next.

  2. Click Browse and then navigate to the location of the TestUML1.zip file (see the download section for this artifact). Click Open.

  3. Click Select All.

  4. Click Finish.

  5. Take a moment to review the UML Model within this imported project.


Figure 2. The imported project
Project Explorer view with Main selected


  1. Double-click the preconfigured WSDLconfig1.tc transformation configuration. Take a moment to review the Transformation Configuration; review the Source and Target and Common tabs. Notice that the Visual Merge option is selected for Merge Options.

  2. Right-click on WSDLconfig1.tc transformation configuration and Transform > UML to WSDL.

  3. Click OK to merge the transformation output (see Figure 3).


Figure 3. Visual display of the merge configuration
Transform merge view, Source and Target sections


  1. Click OK to save (see Figure 4).


Figure 4. Save the target resources that you selected to replace
SaveTarget view


  1. Open the generated Component1.wsdl file within the Test\Sample folder under the TestUML project. Review the WSDL binding section, which is shown in bold in Listing 1.


Listing 1. WSDL binding section

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
     xmlns:tns="http://test.sample/Component1/"
     xmlns:wsdl_1="http://test.sample/"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     name="Component1"
     targetNamespace="http://test.sample/Component1/">
  <wsdl:import location="test.sample.wsdl" namespace="http://test.sample/"/>
  <wsdl:binding name="Interface1Binding" type="wsdl_1:Interface1">
    <wsdl:operation name="Operation1">
      <wsdl:input/>
      <wsdl:output/>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="interface1">
    <wsdl:port binding="tns:Interface1Binding" name="Interface1Port"/>
  </wsdl:service>
</wsdl:definitions>

  1. You are going to use this project to test your plug-in project in the next task. Export your project by selecting File > Export.

  2. In the Import dialog, replace "type filter text" with project.

  3. Then select Project Interchange under Other, as shown in Figure 5.


Figure 5. Select Project Interchange as the export type
Export view with Project Interchange selected


  1. Click Next.

  2. Click Browse and then navigate to a folder of your choice and type the name of the TestUML2.zip file.

  3. Click Save and then Finish.

  4. Right-click on the TestUML project and select Close Project.


Create a plug-in project

You will now create a plug-in project to extend the included UML-to-WSDL transformation so that it generates WSDL files.

  1. Select File > New > Project.

  2. In the New dialog, replace "type filter text" with plug-in, and then select Plug-in Project, as shown in Figure 6.


Figure 6. Create a plug-in project



ALT: Plug-in Project wizard view

  1. Click Next

  2. Name the project com.ibm.uml2.wsdl.binding.extension, and leave the rest of the default settings as they are (see Figure 7).


Figure 7. Create a plug-in project
Only change is project name.


  1. Change the default Plug-in Name field to UML-to-WSDL Transformation Extension, and leave the rest of the default settings (see Figure 8).


Figure 8. Create a plug-in project
Plug-in Content view


  1. Click Next.

  2. In the next view (Figure 9), uncheck the Create a plug-in using one of the templates option and click Finish.


Figure 9. Create a plug-in project
Check box not checked


  1. In the Open Associated Perspective? dialog (shown in Figure 10), click Yes to switch to the Plug-in Development perspective.


Figure 10. Switch to the Plug-in Development view
Open Associated Perspective dialog



Add the required plug-ins

  1. If it is not already open, open the plugin.xml file, switch to the Dependencies tab and click Add.

  2. Type com.ibm.xtools.transform.core, select the first option in the list, and click OK.


Figure 11. Add dependencies
List in Plug-in Selection view


  1. Repeat the previous step to add the following dependencies (shown in Figure 12):
    1. com.ibm.xtools.transform.uml2.wsdl

    2. org.eclipse.xsd

    3. org.eclipse.wst.wsdl

    4. org.wsdl4j




Figure 12. Add dependencies



  1. Switch to the Extensions tab and click to add com.ibm.xtools.transform.core.transformationExtensions.


Figure 13. Add dependencies
New Extension view


  1. Save the plugin.xml file.


Define extension points

Although you could do the rest of the changes by using the respective tabs, it will be quicker to do them in the raw code of the plugin.xml file.

  1. Switch to the plugin.xml tab.

  2. In the extension point, add the following element that contains the information shown in Listing 2 (also shown in Figure 14).


Listing 2. Add an element to the extension point
<TransformationExtension
  version="7.0.0"
  name="TEST-BINDING binding extension"
  enabled="true"
  targetTransformation="com.ibm.xtools.transform.uml2.wsdl.internal.Uml2WsdlTransform.RS"
  id="com.ibm.xtools.transform.uml2.wsdl.extension.TEST-BINDING">
 </TransformationExtension>


Figure 14. Element added to the extension point
Screen capture shows variables in green type


  1. In the TransformationExtension element, create a property that contains the information shown in Listing 3 and Figure 15.


Listing 3. Property to add
	<Property
		id="com.ibm.xtools.transform.uml2.wsdl.bindings.TEST-BINDING"
            metatype="string"
            name="com.ibm.xtools.transform.uml2.wsdl.bindings"
            readonly="true"
            value="TEST-BINDING"/>


Figure 15. Property added
Screen capture of code with variables in green type


  1. In the property that you created in the previous step, define the following rules as shown in Listing 4 and Figure 16.


Listing 4. Define rules
<RuleDefinition
  class="com.ibm.uml2.wsdl.binding.extension.TestBindingAddressExtensionRule"
  id="TestBindingAddressExtensionRule"
  name="TestBindingAddressExtensionRule"/>

<RuleDefinition
  class="com.ibm.uml2.wsdl.binding.extension.TestBindingBindingExtensionRule"
  id="TestBindingBindingExtensionRule"
  name="TestBindingBindingExtensionRule"/>

<RuleDefinition
  class="com.ibm.uml2.wsdl.binding.extension.TestBindingBindingOperationExtensionRule"
  id="TestBindingBindingOperationExtensionRule"
  name="TestBindingBindingOperationExtensionRule"/>


Figure 16. Rules defined
Screen capture of code


  1. In the TransformationExtension element, create the ExtendTransform elements as shown in Listing 5 and Figure 17.


Listing 5. ExtendTransform elements
<ExtendTransform targetTransform="AddressExtensionTransform">
	<AddRule id="TestBindingAddressExtensionRule"/>
</ExtendTransform>

<ExtendTransform targetTransform="BindingExtensionTransform">
      <AddRule id="TestBindingBindingExtensionRule"/>
</ExtendTransform>

<ExtendTransform targetTransform="BindingOperationExtensionTransform">
      	<AddRule id="TestBindingBindingOperationExtensionRule"/>
</ExtendTransform>


Figure 17. Configure the plugin.xml file code
Screen capture of added elements


  1. Click File > Save.


Provide Java implementations for the transformation rules

  1. For each rule that you defined in the plugin.xml, create the corresponding Java class in the plug-in that you created in previous task. The Java classes that you create must extend the corresponding abstract classes, and implement the corresponding abstract methods:
    1. com.ibm.uml2.wsdl.binding.extension.TestBindingAddressExtensionRule class must extend com.ibm.xtools.transform.uml2.wsdl.util.AbstractAddressExtensionRule

    2. com.ibm.uml2.wsdl.binding.extension.TestBindingBindingExtensionRule class must extend com.ibm.xtools.transform.uml2.wsdl.util.AbstractBindingExtensionRule

    3. com.ibm.uml2.wsdl.binding.extension.TestBindingBindingOperationExtensionRule class must extend com.ibm.xtools.transform.uml2.wsdl.util.AbstractBindingOperationExtensionRule



  2. Right-click on src\com.ibm.uml2.wsdl.binding.extension folder and select Import

  3. In the Import dialog, replace type filter text with file. Then select File System under General, as shown in Figure 18.


Figure 18. Select File System as the import type
Import dialog box


  1. Click Next

  2. Browse to the location of Java™ files (see the download section for Java files) and select only the Java files as shown in Figure 19.


Figure 19. Import rules implementations
Import view


  1. Click Finish and take a moment to review the imported Java files (see Figure 20).


Figure 20. Import rules implementations
Package Explorer tab and item tree



Test the transformation extension

In this task you will test the transformation plug-in in a separate Eclipse workbench. You will import the test UML model that you used to run the UML-to-WSDL transformation, and you will be able to compare transformation results.

  1. Select the com.ibm.uml2.wsdl.binding.extension plug-in project and then, from the toolbar, select Run > Debug.

  2. Double-click the Eclipse Application in the Run Configuration dialog, and change the name of the configuration to Transformation Extension Launch. Leave the rest of the default settings as they are.

  3. Click Debug (see Figure 21). This will launch a new Eclipse workbench.


Figure 21. Set the launch configuration
Debug view


  1. On the Welcome screen, click the curved arrow icon with the yellow point to go to the workbench.

  2. Switch to the Modeling perspective.

  3. Select File > Import.

  4. In the Import dialog, replace "type filter text" with project. Then select Project Interchange under Other, as shown in Figure 22.


Figure 22. Select Project Interchange as the import type
Import Select view with Other highlighted


  1. Click Next.

  2. Click Browse and then navigate to the location of the TestUML2.zip file, and select the TestUML2.zip file that you exported in previous task (you can download it from the download section in case you have not exported your project in Task 1). Click Open.

  3. Click Select All.

  4. Click Finish.

  5. Double-click the WSDLconfig1.tc transformation configuration to open it.

  6. Right-click the WSDLconfig1.tc in Project Explorer and select Transform > UML to WSDL.

  7. Take a moment to review the changes between the regular transformation result and the extended transformation result in the Transformation Merge dialog. Notice that the binding is changed to SOAP-Document-Literal and the SOAP address is also added (see Figure 23).


Figure 23. Compare transformation results
Transform Merge view, which has four sections


  1. Click the first arrow icon in the middle of the dialog: Copy All from Left to Right.


Figure 24. Accept the changes
Right-arrow icon circled


  1. Click OK twice to save the changes.


Figure 25. Save the changes
Save Target dialog with checkbox checked


Now, your WSDL files have been generated and are ready for editing.


Acknowledgements

Special thanks to Dmitry Gorelik, Lee Ackerman, Aaron Allsbrook, and Jim Conallen for their support and contributions.



Download

DescriptionNameSizeDownload method
Simple Projectextend_uml_wsdl_inputs.zip9KB HTTP

Information about download methods


Resources

Learn

Get products and technologies

Discuss

About the author

author photo

Sefa Sevtekin is a senior solution architect in IBM Rational Software Services Group. He's been working with customers on implementing Model Driven Achitecture (MDA) using IBM Rational Tooling.He has delivered various international seminars, workshops, techinal articles, customer trainings, and consulting services.

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational
ArticleID=386235
ArticleTitle=Build Eclipse plug-ins to extend Rational Software Architect UML to WSDL transformations
publish-date=05052009
author1-email=sevtekin@us.ibm.com
author1-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers