Skip to main content

How to extend the UML-to-WSDL transformation

 Technote (FAQ)
 
Question
How can you extend the UML-to-WSDL transformation provided with IBM® Rational® Software Architect version 7.x?
 
Cause
By default the UML-to-WSDL transformation generates full path for the soapAction parameter such as:

    <soap:operation soapAction="http://com.ibm.support.rsm.wsdl/Component1/Operation1/"/>

A plugin can be created to customize the transformation so that it generates a parameter such as:


    <soap:operation soapAction="Operation1/"/>
 
Answer
 DISCLAIMER:

All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Create a new plugin that contribute to the Transformation extension:
  1. File > New > Project > Plugin project:
    1. Enter a Name
    2. Click on Next
    3. Click on Next
    4. Uncheck Create a plug-in using one of the templates
    5. Click on Finish and switch to the Plug-in Development perspective

  2. Edit the plugin.xml using the Plug-in Manifest Editor:
    1. Select the Extensions tab
    2. Click Add
    3. Select the Extensions Wizards tab
    4. Select Transformation templates
    5. Select Transformation Extension
    6. Click Next

  3. On the Create a new transformation extension page:
    1. Enter Target Transform ID = com.ibm.xtools.transform.uml2.wsdl.internal.Uml2WsdlTransform
    2. Click Next

  4. On the Define transformation elements page:
    1. Click Insert
    2. Select Type=Rule
    3. Enter ID=MyBindingOperationExtensionRuleID
    4. Enter Name=MyBindingOperationExtensionRuleName
    5. Enter Class=MyBindingOperationExtensionRule
    6. Enter Package=com.ibm.support.rsm
    7. Click Next

  5. On the Define transforms and link transformation elements:
    1. Click on Insert on the Extended transforms list
    2. Enter Target transformation ID=BindingOperationExtensionTransform
    3. Click on Insert on the Additions to selected extended transform list
    4. Select Element type=Rule
    5. Select ID=MyBindingOperationExtensionRuleID

  6. Click Finish

  7. Add plug-in dependencies to Compile:
    1. On the Plug-in Descriptor, select the Dependencies tab
    2. Click on Add under "Required Plug-ins"
    3. Enter com.ibm.xtools.transform.uml2.wsdl
    4. Click OK
    5. Repeat the 3 steps above for the following plug-ins:
      • org.eclipse.wst.wsdl
      • org.wsdl4j
      • org.eclipse.emf.ecore
    6. Select File>Save from the menu

  8. Modify the generated code:
    1. Open file com.ibm.support.rsm.MyBindingOperationExtensionRule
    2. Change the inheritance from AbstractRule to AbstractBindingOperationExtensionRule
    3. Remove the CreateTarget method
    4. Add Unimplemented method (click on the Quick Fix icon)

  9. Add custom code as in attached project interchange:
    To modify the default generated soapAction parameter, add the following code:
    protected ExtensibilityElement createBindingOperationExtensibilityElement(
    BindingOperation bindingOperation) {
    System.out.println("****** modifying soapAction value *******");

    List ops = bindingOperation.getExtensibilityElements();
    Iterator iter = ops.iterator();
    while(iter.hasNext()){
    ExtensibilityElement op = (ExtensibilityElement) iter.next();
    if(op instanceof SOAPOperation){
                   System.out.println("Existing SOAP operation found");
    SOAPOperation soapop = (SOAPOperation) op;
    System.out.println("soapAction="+soapop.getSoapActionURI());
    //set value without TNS
    soapop.setSoapActionURI(bindingOperation.getName() + '/');
    return soapop;
    }
    else
    System.out.println("op="+op);
    }
    return null;
    }
  10. Modify the other methods as well, as in the attached example and Save all files

  11. Run the plug-in as an Eclipse application

  12. Create a UML model and transform it (See also attachments)


Do you need more help?

For additional assistance, contact IBM Rational Client Support:
Submit a Service Request (SR)

 
Related information
Modeling and generating XML Schema
Modeling and generating WSDL
WSDL and UML Transformation in Rational Software Archit
 
myuml2wsdl.zip model.zip
 
 

Copyright and trademark information

IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.

Rate this page

Please take a moment to complete this form to help us better serve you.

This material provides me with the information I need.






This material is clear and easy to understand.






Did the information help you to achieve your goal?

What updates, improvements, or related information would you like to see in this document?

Your response will be used to improve our document content. Requests for assistance, if applicable, should be submitted through your normal support channel as we cannot respond from this site.


Input the verification number to submit feedback:



Maintenance Window

Unscheduled Maintenance Window

There is no unscheduled maintenance scheduled at this time.

Document information

Product categories:

Software

Software Development

Analysis, Modeling, Design & Construction

Rational Software Architect

Transformation


Operating system(s):

Windows


Software version:

7.0.0.5, 7.0.0.6


Reference #:

1260698


IBM Group:

Software Group


Modified date:

2008-09-17

Translate my page