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
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 name | Property description | Corresponding JMS address value |
|---|---|---|
destination | The JNDI name of the destination queue or topic | jndiDestinationName |
connectionFactory | The JNDI name of the connection factory. | jndiConnectionFactory |
targetService | Port name for target service in case the implementation is in WID | targetService |
Table 1B. Valid properties for use with the
<soap:address> tag| JNDI-related properties (optional) | Property description | Corresponding JMS address value |
|---|---|---|
initialContextFactory | The name of the initial context factory | initialContextFactory |
jndiProviderURL | The JNDI provider URL | jndiProviderURL |
Table 1C. Valid properties for use with the
<soap:address> tag| JMS-related properties (optional) | Property description | Corresponding JMS address value |
|---|---|---|
deliveryMode | Indicates whether the request message should be persistent or not, with these valid values:
| JMSDeliveryMode |
Password | The password to be used to gain access to the connection factory | JMSPassword |
Priority | The JMS priority associated with the request message; valid values are 0 to 9; and the default value is 4 | JMSPriority |
replyTo | The JNDI destination queue to which reply messages should be sent | JMSReplyTo |
timeToLive | The lifetime (in milliseconds) of the request message; a value of 0 indicates an infinite lifetime | JMSTimeToLive |
userid | The user ID to be used to gain access to the connection factory | JMSUserid |
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:
- There is no
soapActioninsoap:operation. - The
soap:bindingtransport ishttp://schemas.xmlsoap.org/soap/jms. - The
soap:addressis 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 name | Description |
|---|---|
CustomJmsAddressExtensionRule | Retrieve the JMSLocation property value. Set that value to the value for soap:address location attribute. |
CustomJmsBindingExtensionRule | Set this value for the soap:binding transport: http://schemas.xmlsoap.org/soap/jms |
CustomJmsBindingOperationExtensionRule | Set 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
Figure 2. New property in the properties pane
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
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 name | Description |
|---|---|
SOAPHeaderAddressExtensionRule | Same as default implementation for DOCUMENT-LITERAL |
SOAPHeaderBindingExtensionRule | Same as default implementation for DOCUMENT-LITERAL |
SOAPHeaderBindingOperationExtensionRule | Extracts 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>
|
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.
Sincere thanks to Dmitry Gorelik (IBM Canada), Murali Pattathe (IBM Canada) and Priyankar Malakar (IBM India) for their help in reviewing this article.
| Description | Name | Size | Download method |
|---|---|---|---|
| Plugin and code for RSA 7.0 | plugins_and_code_for_RSA_70.zip | 24KB | HTTP |
| Plugin and code for RSA 7.5 | plugins_and_code_for_RSA_75.zip | 42KB | HTTP |
Information about download methods
Learn
-
All of these sources provide additional helpful information:
- Transformation to SOA: Part 3. UML to SOA by Dmitry Gorelik (IBM developerWorks, January 2008)
- How to extend the UML-to-WSDL transformation
- The SOAP over JMS provider
- Which style of WSDL should I use? by Russell Butek (developerWorks, May 2005)
- Charter of the W3C SOAP-JMS Binding Working Group
- Web services programming tips and tricks: Using SOAP headers with JAX-RPC by Andre Tost (developerWorks, October 2003)
-
Visit the Rational software area on developerWorks for technical resources and best practices for Rational Software Delivery Platform products.
-
Explore Rational computer-based, Web-based, and instructor-led online courses. Hone your skills and learn more about Rational tools with these courses, which range from introductory to advanced. The courses on this catalog are available for purchase through computer-based training or Web-based training. Additionally, some "Getting Started" courses are available free of charge.
-
Subscribe to the Rational Edge newsletter for articles on the concepts behind effective software development.
-
Subscribe to the IBM developerWorks newsletter, a weekly update on the best of developerWorks tutorials, articles, downloads, community activities, webcasts and events.
-
Browse the technology bookstore for books on these and other technical topics.
Get products and technologies
-
Download trial versions of IBM Rational software.
- Download these
IBM product evaluation versions
and get your hands on application development tools and middleware products from
DB2®, Lotus®, Tivoli®, and WebSphere®.
Discuss
- Check out
developerWorks blogs and get involved in the developerWorks community.
Comments (Undergoing maintenance)






