Published on WSO2 Oxygen Tank (http://wso2.org)

Configuring Transport URLs to be Different from the WS-Addressing Endpoint

By chinthaka
Created 2008-06-04 22:16

Often times the requirement comes up to send a SOAP envelope to a different location than what's specified inside WS-Addressing 'To' address. This knowledge base by Eran Chinthaka outlines how.

 

SOAP messages contain WS-Addressing properties to help direct navigation to target nodes. WS-Addressing 'To' header encapsulates the ultimate target destination of a message. Still, there are other circumstances (for example proxies and firewalls) in which, it requires you to send messages to different address nodes than the ones described within WS-Addressing 'To' headers.

Axis2 empowers you to add a URL to the WS-Addressing 'To' header and add a different URL as the transport address. Let's see how we can go about doing this:

First, we need to set a property in Axis2 for this purpose. Let's assume we have access to the 'Options' object (Please refer "Configuring Properties within Axis2 [1]" to find out more about setting propeties in Axis2). Then set

Constants.Configuration.TRANSPORT_URL

property within the 'Options' object, to transport URL you want the message to be sent.

options.setProperty(Constants.Configuration.TRANSPORT_URL, "http://mysite.net/messages/should/come/here");

Then, set 'To' address using options.setTo() method

EndpointReference toAddress = new EndpointReference("http://mysite.net/this-is-wsa-to-address/");
options.setTo(toAddress);

 

Applies To

1. Apache Axis2/Java 1.3 or later

2. JDK 1.4 or later

 

Author : Eran Chinthaka, Member-Apache Software Foundation. eran(dot)chinthakaXgmail.com, where X=@

 


Source URL:
http://wso2.org/library/3671