Axis2-SOAP-Header problem

Hello everybody again.
Currently I am working with web-services, and my current implementation of the project uses Axis2. Few days back I was stuck with a very weird problem. Scenario was like this.
I have a Web-Application(WA) which is supposed to call a web-service (WS1) which in turn will forward the request to another web-service (WS2) which in turn will forward the request to final web-service(WS3). I have made a generic stub which is used to call any web-service(And I have disabled the header adding code inside this stub because of project requirement.) So the WA was preparing a document and sending it to the WS1 using the generic stub, Now WS1 does some processing and send it to WS2 using the same generic stub, and WS2 again sends it to WS3 using the same generic stub. Now my requirement was that there should not be any SOAP Header in my requests because if it exists then the document will fail the validation. So the problem was that when the document was reaching WS1 it was not having any header and it passed the validation test but when it reaches the WS2 it failed validation. When I traced the log I found that it was having a SOAP Header.
It was very weird since the same stub was being used so how cum there were two documents being generated one with header and the other without header.
After tracing all the logs I didn’t found anything. So finally I used the soap-monitoring tool to see what actually is being transmitted on wires from one WS to the other. Then I came to know, when one WS is sending the document to the other WS it is adding SOAP Header into the document and after a some brain storming I concluded that it does so because by default addressing is enabled at the global level and it is the addressing which was responsible for doing this.
So I disabled the addressing module and it worked. Now the document being passed from one WS to the other WS is not having the SOAP header. 😀
To disable the addressing module you simply go to axis2.xml file and find this line.

<module ref=”addressing”/>

Comment this line and the addressing module is disabled.

Advertisements