How to implement a SOAP web service client using WS-Addressing in TIBCO ActiveMatrix BusinessWorks™?

What is WS-Addressing?
Web Services Addressing (WS-Addressing, WSA) is a specification of transport-neutral mechanism or extension that allow web services to communicate addressing information (To, Action, MessageID). It is a member of the web service specifications and was published by OASIS.

Prerequisite
Prerequisite is the SOAP web service client implementation using the concrete WSDL. In this blogpost I will be only describing the extension of the SOAP web service client implementation with WS-Addressing.

Implementation
Although WS-Addressing is not officially supported, there is actually a workaround to implement this functionality. The workaround involves adjusting the concrete WSDL to extend the SOAP header. We should define this header in a separate XSD to keep the original WSDL clean.

The header XSD contains the following elements and attributes:

<?xml version=”1.0″ encoding=”UTF-8″?><xs:schema xmlns:xs=”http://www.w3.org/2001/XMLSchema&#8221; xmlns:wsa=”http://www.w3.org/2005/08/addressing&#8221; xmlns:tns=”http://schemas.xmlsoap.org/soap/envelope/&#8221; targetNamespace=”http://www.w3.org/2005/08/addressing&#8221; elementFormDefault=”qualified” attributeFormDefault=”unqualified”><xs:import namespace=”http://schemas.xmlsoap.org/soap/envelope/&#8221; schemaLocation=”SoapEnvelope.xsd”/><xs:element name=”To” type=”xs:anySimpleType”/><xs:element name=”Action” type=”xs:anySimpleType”/><xs:element name=”MessageID” type=”xs:anySimpleType”/><xs:element name=”Header”><xs:complexType><xs:sequence><xs:element ref=”wsa:To” minOccurs=”0″/><xs:element ref=”wsa:Action” minOccurs=”0″/><xs:element ref=”wsa:MessageID” minOccurs=”0″/></xs:sequence></xs:complexType></xs:element></xs:schema></xs:schema>

After creating the XSD we need to define the namespace in the original WSDL:

xmlns:wsa=”http://www.w3.org/2005/08/addressing&#8221;

Import the XSD:

<xs:import namespace=”http://www.w3.org/2005/08/addressing&#8221; schemaLocation=”Header.xsd”/>

And create a message type that we can reuse in the WSDL operation:

<wsdl:message name=”Header”>
<wsdl:part element=”wsa:To” name=”To”/>
<wsdl:part element=”wsa:Action” name=”Action”/>
<wsdl:part element=”wsa:MessageID” name=”MessageID”/>
</wsdl:message>

Finally we extend the existing WSDL operation with the message as created:

<soap:header message=”Header” part=”To” use=”literal”/>
<soap:header message=”Header” part=”Action” use=”literal”/>
<soap:header message=”Header” part=”MessageID” use=”literal”/>

After saving the WSDL and reloading the TIBCO project we will notice that the WSDL input in the SOAPRequestReply activity will allow us to map the several defined WS-Addressing element “To”, “Action” and “MessageID”.

1

1

After mapping the header we finished the implementation and can now move forward testing the solution.

Test
Best practice:
Add the following lines to your local designer.tra for testing and debugging purposes, this will show you the entire SOAP message including headers and namespaces.

#
# Set debug mode for SOAP messages
java.property.com.tibco.plugin.soap.trace.inbound=true
java.property.com.tibco.plugin.soap.trace.outbound=true
java.property.com.tibco.plugin.soap.trace.pretty=true
java.property.com.tibco.plugin.soap.trace.stdout=true


If you do a test you will find out that the following header and namespaces have been added to the SOAP request:

<ns:To xmlns:ns=”http://www.w3.org/2005/08/addressing”>To</ns:To&gt;
<ns:Action xmlns:ns=”http://www.w3.org/2005/08/addressing”>Action</ns:Action&gt;
<ns:MessageID xmlns:ns=http://www.w3.org/2005/08/addressing”>MessageID<ns:MessageID>

This was my second blogpost, I hope you all enjoyed it!

Advertisements

One comment

  1. Reblogged this on anz.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: