Skip to main content

Build extension plug-ins for JMS end points and SOAP headers

Plug-ins that work in Rational Software Architect and also ported for Rational Software Architect for WebSphere Software

author photo
Aditya P. Dutta works as an IT Architect at IBM Global Business Services, India. He specializes in conceptualizing and building enterprise integration solutions. He provides consulting and architectural assistance to IBM customers.

Summary:  This article provides an overview of the extensibility features of the IBM® Rational® Software Architect UML-to-WSDL transformation feature, and then it illustrates a technique to build extensions to support JMS end points and SOAP headers.

Date:  28 Apr 2009
Level:  Intermediate
Activity:  658 views

At the intersection between model-driven service-oriented architecture (SOA) and Web services, IBM Rational Software Architect Version 7.0 and Rational Software Architect for WebSphere Software Version 7.5 play a pivotal role. (Hereafter, "Rational Software Architect" means either in this context.) Either version can be used to model enterprise services, and both versions support transformation of this UML-based service model into Web Service Description Language (WSDL) files, which can then be used to create the Web services. The screenshots provided are for IBM Rational Software Architect Version 7.0. But, the code downloads have working plug-ins for both IBM Rational Software Architect Version 7.0 and Rational Software Architect for WebSphere Software Version 7.5.

Overview of transforming UML models into artifacts for Web services development

IBM Rational Software Architect provides the necessary modeling support to enable model-driven development of SOA solutions. It also supports transformation of UML models into domain-specific software artifacts that can then be used as input for further development and deployment. For Web services-based integration architectures, the UML-based service models can be transformed into WSDL, which developers can then import into various tools and build the service implementation against the service contract defined by the WSDL. At the time of writing this article, Rational Software Architect does not support the following critical aspects of the process:

  • Java™ Message Service (JMS) end points in WSDL, which is necessary when SOAP/JMS is the interaction mechanism
  • SOAP headers

SOAP over JMS

JMS is becoming a popular transport protocol for Web services. For example, SOAP over JMS is being used to introduce the benefits of a robust and asynchronous messaging backbone to Web services.

Need to specify JMS binding during WSDL generation

Thus, it is very important to be able to generate WSDL files that support JMS end points rather than the default HTTP end points. Yet currently, there is no agreed-upon interoperable standard for specifying SOAP/JMS binding in WSDL, although a W3C working group exists with the mission to produce a recommendation for how SOAP should bind to a transport that supports JMS. Due to this lack of interoperable standard specifications for now, many tools lack enough support for this purpose, especially architecture management tools to generate SOAP/JMS bindings in WSDL. Even so, there is already lot of support for SOAP/JMS in development tools and runtime engines, such as IBM® WebSphere® Integration Developer and WebSphere Message Broker.

Nonetheless, there is sufficient understanding, and there is a commonly used format of the SOAP fragment that is required to specify JMS binding in WSDL. This format is supported by IBM WebSphere Process Server and IBM WebSphere Application Server.

Therefore, it is imperative that the architecture management tools such as Rational Software Architect be extended so that they can generate WSDL files that can work for SOAP/JMS. The code snipped in Listing 1 shows a common way of doing this.


Listing 1. A common format to specify JMS binding in WSDL

jms:/[queue|topic]?<property>=<value>&<property>=<value>&...

<!-- In that example, the specification of queue or topic corresponds to the JMS address 
destinationStyle attribute. For example: -->
jms:/queue?destination=jms/XYZ&connectionFactory=jms/XYZ&targetService=ServicePort

<wsdl:port name="ABCPort" 
        binding="sqi:ABCSoapJMSBinding">
    <soap:address location="jms:/queue?destination=myQ&connectionFactory=myQCF/" />
</wsdl:port>

The following three tables show the valid properties to use with the <soap:address> tag.


Table 1A. Valid properties for use with the <soap:address> tag
Property nameProperty descriptionCorresponding JMS address value
destinationThe JNDI name of the destination queue or topicjndiDestinationName
connectionFactoryThe JNDI name of the connection factory.jndiConnectionFactory
targetServicePort name for target service in case the implementation is in WIDtargetService

Table 1B. Valid properties for use with the <soap:address> tag
JNDI-related properties (optional)Property descriptionCorresponding JMS address value
initialContextFactoryThe name of the initial context factoryinitialContextFactory
jndiProviderURLThe JNDI provider URLjndiProviderURL

Table 1C. Valid properties for use with the <soap:address> tag
JMS-related properties (optional) Property descriptionCorresponding JMS address value
deliveryModeIndicates whether the request message should be persistent or not, with these valid values:
  • DeliveryMode.NON_PERSISTENT (default)
  • DeliveryMode.PERSISTENT
JMSDeliveryMode
PasswordThe password to be used to gain access to the connection factoryJMSPassword
PriorityThe JMS priority associated with the request message; valid values are 0 to 9; and the default value is 4JMSPriority
replyToThe JNDI destination queue to which reply messages should be sentJMSReplyTo
timeToLiveThe lifetime (in milliseconds) of the request message; a value of 0 indicates an infinite lifetimeJMSTimeToLive
useridThe user ID to be used to gain access to the connection factoryJMSUserid

Build a transformation extension plug-in to generate WSDL with SOAP over JMS binding

The purpose of the plug-in is to build a transformation extension that can use a UML service model as the source and generate WSDL that differs from standard DOCUMENT-LITERAL WSDL in these ways:

  1. There is no soapAction in soap:operation.

  2. The soap:binding transport is http://schemas.xmlsoap.org/soap/jms.

  3. The soap:address is in the format described in Listing 1.

The XML code shown in Listing 2 contains the transformation extensions and extension rule definitions needed for those conditions.


Listing 2. The plugin.xml code for the JMS binding custom extension

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
        point="com.ibm.xtools.transform.core.transformationExtensions">
        <!-- Custom non-standard JMS binding -->
        <TransformationExtension
        	id="com.ibm.xtools.transform.uml2.wsdl.extension.CUSTOM_JMS_DOCUMENT"
        	name="CUSTOM_JMS_DOCUMENT binding extension Transformation extension"
        	targetTransformation=
			"com.ibm.xtools.transform.uml2.wsdl.internal.Uml2WsdlTransfor.RS"
        	version="1.0.0"
        	enabled="true">
            <Property
                  id="com.ibm.xtools.transform.uml2.wsdl.bindings.CUSTOM_JMS_DOCUMENT"
                  metatype="string"
                  name="com.ibm.xtools.transform.uml2.wsdl.bindings"
                  readonly="true"
                  value="CUSTOM_JMS_DOCUMENT"/> 
<!-- This value (CUSTOM_JMS_DOCUMENT) will 
show up in configuration editor "Binding Options" tab along with all other bindings 
provided as a part of the WSDL transformation -->
        	 <RuleDefinition
           		class="com.ibm.support.rsm.CustomJmsAddressExtensionRule"
           		id="CustomJmsAddressExtensionRule"
           		name="CustomJmsAddressExtensionRule"/>
            <RuleDefinition
                  class="com.ibm.support.rsm.CustomJmsBindingExtensionRule"
                  id="CustomJmsBindingExtensionRule"
                  name="CustomJmsBindingExtensionRule"/>
            <RuleDefinition
                  class="com.ibm.support.rsm.CustomJmsBindingOperationExtensionRule"
                  id="CustomJmsBindingOperationExtensionRule"
                  name="CustomJmsBindingOperationExtensionRule"/>
           	<ExtendTransform
                  targetTransform="AddressExtensionTransform">
              <AddRule 
              	 id="CustomJmsAddressExtensionRule"/>
		    </ExtendTransform>
            <ExtendTransform
                  targetTransform="BindingExtensionTransform">
               <AddRule 
                  id="CustomJmsBindingExtensionRule"/>
            </ExtendTransform>
            <ExtendTransform
                  targetTransform="BindingOperationExtensionTransform">
               <AddRule 
                  id="CustomJmsBindingOperationExtensionRule"/>
            </ExtendTransform>
		</TransformationExtension>    
	</extension>

   <extension
         point="com.ibm.xtools.transform.core.transformationExtensions">
      <TransformationExtension
            id="CustomJMS.transformationExtension"
            name="Transformation Extension"            targetTransformation=
"com.ibm.xtools.transform.uml2.wsdl.internal.Uml2WsdlTransform"
            version="1.0.0">
         <Property
               id="JMSLocationID"
               metatype="String"
               name="JMSLocation"
               readonly="false"
               value="JMSLocationDefaultValue"/>
      </TransformationExtension>
   </extension>
</plugin>

Based on that plugin.xml, you need the Java classes shown in Table 2 to be implemented.


Table 2. Java classes that must be implemented
Class nameDescription
CustomJmsAddressExtensionRuleRetrieve the JMSLocation property value. Set that value to the value for soap:address location attribute.
CustomJmsBindingExtensionRuleSet this value for the soap:binding transport: http://schemas.xmlsoap.org/soap/jms
CustomJmsBindingOperationExtensionRuleSet the value for soap:operation soapAction as null.

After the plug-in is deployed on a Rational Software Architect installation, when you create a new UML to WSDL transformation configuration, you can see an additional entry for CUSTOM_JMS_DOCUMENT in the WSDL Options drop-down menu (see Figure 1), along with the existing ones (SOAP-DOCUMENT-LITERAL, HTTP-GET, and so forth). You can use the new property to set the JMS binding details for a particular interface. The value you set in the properties pane for JMSLocation gets set into the soap:address location attribute of the WSDL output (see Figure 2).


Figure 1. New entry in the binding options view
CUSTOM_JMS_DOCUMENT selected in menu

Figure 2. New property in the properties pane
Property and Value column, JMSLocation circled

SOAP headers

Like any good messaging protocol, SOAP defines the concept of a message header, which is an optional part of any SOAP message. If it exists, the header contains information about the message, or about the context in which the message is sent, or whatever the creator of the message thought was a good idea to put there instead of the actual body of the message.

Model SOAP headers as part of the service specification

During modeling of services, there is an obvious need to model the headers along with the input and output payload of the service interface. Therefore, SOAP headers are a critical aspect of SOA modeling. But, as Listing 3 shows, support for modeling SOAP headers as part of the UML service model wasn't included.


Listing 3. SOAP headers W3 specification

<definitions .... >
    <binding .... >
        <operation .... >
           <input>
             <soap:header message="qname" part="nmtoken" use="literal|encoded"
                          encodingStyle="uri-list"? namespace="uri"?>
             <soap:header>*                                
           </input>
           <output>
               <soap:header message="qname" part="nmtoken" use="literal|encoded"
                            encodingStyle="uri-list"? namespace="uri"?>
               <soap:header>*                                
           </output>
        </operation>
    </binding>
</definitions>

Build a transformation extension plug-in to generate WSDL with SOAP headers

The goal of the plug-in is to build a transformation extension to enable modeling of headers and then, based on the model, to generate soap:header in the WSDL.

In the Rational Software Architect UML model, add additional parameters to the UML operation and then, for the parameters that you need to be specified as SOAP headers, add the keyword of "soapHeader."


Figure 3. SOAP headers modeled using keyword
soapHeader added under validatePayment

Listing 4. plugin.xml for the SOAP Header custom extension

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
        point="com.ibm.xtools.transform.core.transformationExtensions">
                       
        <!-- Custom non-standard JMS binding -->
        <TransformationExtension
        	id="com.ibm.xtools.transform.uml2.wsdl.extension.SOAP_HEADER_DOCUMENT"
        	name="SOAP_HEADER_DOCUMENT binding extension Transformation extension"
        	targetTransformation=
			"com.ibm.xtools.transform.uml2.wsdl.internal.Uml2WsdlTransform.RS"
        	version="1.0.0"
        	enabled="true">
            <Property
                  id="com.ibm.xtools.transform.uml2.wsdl.bindings.SOAP_HEADER_DOCUMENT"
                  metatype="string"
                  name="com.ibm.xtools.transform.uml2.wsdl.bindings"
                  readonly="true"
                  value="SOAP_HEADER_DOCUMENT"/>
<!-- this value (SOAP_HEADER_DOCUMENT) 
will show up in configuration editor "Binding Options" tab along with all other bindings 
provided as a part of the WSDL transformation -->

<RuleDefinition
           		class="com.ibm.support.rsm.SOAPHeaderAddressExtensionRule"
           		id="SOAPHeaderAddressExtensionRule"
           		name="SOAPHeaderAddressExtensionRule"/>
            <RuleDefinition
                  class="com.ibm.support.rsm.SOAPHeaderBindingExtensionRule"
                  id="SOAPHeaderBindingExtensionRule"
                  name="SOAPHeaderBindingExtensionRule"/>
            <RuleDefinition
                  class="com.ibm.support.rsm.SOAPHeaderBindingOperationExtensionRule"
                  id="SOAPHeaderBindingOperationExtensionRule"
                  name="SOAPHeaderBindingOperationExtensionRule"/>
           	<ExtendTransform
                  targetTransform="AddressExtensionTransform">
              <AddRule 
              	 id="SOAPHeaderAddressExtensionRule"/>
		    </ExtendTransform>
            <ExtendTransform
                  targetTransform="BindingExtensionTransform">
               <AddRule 
                  id="SOAPHeaderBindingExtensionRule"/>
            </ExtendTransform>
            <ExtendTransform
                  targetTransform="BindingOperationExtensionTransform">
               <AddRule 
                  id="SOAPHeaderBindingOperationExtensionRule"/>
            </ExtendTransform>
		</TransformationExtension> 
     
	</extension>

</plugin>

Based on the preceding plugin.xml file, you need the following Java classes shown in Table 3 to be implemented.


Table 3. Java classes
Class nameDescription
SOAPHeaderAddressExtensionRuleSame as default implementation for DOCUMENT-LITERAL
SOAPHeaderBindingExtensionRuleSame as default implementation for DOCUMENT-LITERAL
SOAPHeaderBindingOperationExtensionRuleExtracts the parameters with soapheader keyword and sets them into the SOAP Header instead of SOAP Body which is the case of the other parameters

After the plug-in is deployed in a Rational Software Architect installation, when you create a new UML-to-WSDL transformation configuration, you will see an additional entry of SOAP_HEADER_DOCUMENT in the WSDL Options drop-down menu, along with the existing ones, such as SOAP-DOCUMENT-LITERAL, HTTP-GET.

After selecting the SOAP_HEADER_DOCUMENT value, if you run the transformation, the WSDL generated would look like what Listing 5 shows.


Listing 5. WSDL generated with soap:header

<wsdl:operation name="validatePayment">
  <wsdl:input>
    <soap:header message="wsdl_1:PaymentvalidatePaymentRequest" part="OspreyHeaderIn" 
use="literal"/>
    <soap:body parts="ValidatePaymentRequest" use="literal"/>
  </wsdl:input>
  <wsdl:output>
    <soap:header message="wsdl_1:PaymentvalidatePaymentResponse" part="OspreyHeaderOut" 
use="literal"/>
    <soap:body parts="ValidatePaymentResponse" use="literal"/>
  </wsdl:output>
</wsdl:operation>

Summary

This article explained the growing need to support JMS bindings and SOAP headers as part of the Rational Software Architect UML-to-WSDL transformation. It described one possible way to build transformation extension plug-ins to achieve that goal.

Acknowledgements

Sincere thanks to Dmitry Gorelik (IBM Canada), Murali Pattathe (IBM Canada) and Priyankar Malakar (IBM India) for their help in reviewing this article.



Downloads

DescriptionNameSizeDownload method
Plugin and code for RSA 7.0plugins_and_code_for_RSA_70.zip24KBHTTP
Plugin and code for RSA 7.5plugins_and_code_for_RSA_75.zip42KBHTTP

Information about download methods


Resources

Learn

Get products and technologies

Discuss

About the author

author photo

Aditya P. Dutta works as an IT Architect at IBM Global Business Services, India. He specializes in conceptualizing and building enterprise integration solutions. He provides consulting and architectural assistance to IBM customers.

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=384196
ArticleTitle=Build extension plug-ins for JMS end points and SOAP headers
publish-date=04282009
author1-email=adidutta@in.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).

Rate a product. Write a review.

Special offers