Sunday, February 10, 2013

How to remove or set empty value to HTTP header SOAPAction on outgoing message in WSO2 ESB

When you invoke a web service, there is a HTTP header called SOAPAction which keeps the value of service operation name. if you want to remove or set empty value for SOAPAction within your proxy service, following configuration in your proxy configuration can do it. Both header and property mediators are required.

To set empty string to SOAPAction


<header name="Action" value="" />  
<property name="SOAPAction" scope="transport" value="" /> 

Then out put will be:
 POST /services/SimpleStockQuoteService HTTP/1.1  
 Content-Type: text/xml; charset=UTF-8  
 Accept-Encoding: gzip,deflate  
 SOAPAction:   
 TransformationSequence: s1  
 Transfer-Encoding: chunked  
 Host: 127.0.0.1:9000 

To remove SOAPAction

<header name="Action" action="remove" />  
<property name="SOAPAction" scope="transport" action="remove" />  

Then out put will be:

 POST /services/SimpleStockQuoteService HTTP/1.1  
 Content-Type: text/xml; charset=UTF-8  
 Accept-Encoding: gzip,deflate  
 TransformationSequence: s1  
 Transfer-Encoding: chunked  
 Host: 127.0.0.1:9000 

if you want to change the SOAPAction value, header mediator can do this.

<header name="Action" value="newAction" /> 

Then out put will be:

 POST /services/SimpleStockQuoteService HTTP/1.1  
 Content-Type: text/xml; charset=UTF-8  
 Accept-Encoding: gzip,deflate  
 TransformationSequence: s1  
 SOAPAction: "newAction"  
 Transfer-Encoding: chunked  
 Host: 127.0.0.1:9000  





No comments:

Post a Comment