title: Spring Integration : Namespace change before sending request to ESB or other webservices
body: <p>I am using spring integration for developing webservices as project requirement and
  I am looking some way to modify the namespace when sending the request to other interface let's say Mule ESB or other webservice. As per of project need, I need to have namespace for my webservice internally as let's say "xmlns:mod="http://www.xyx.com/pojo" while the interface(like Mule ESB) uses "xmlns:mod="http://www.xyx.com/model" namespace. so before sending the request to Mule ESB, I need to modify namespace for the request payload so that ESB can map the object elements and again, when receive the response from Mule ESB interface, I need to again modify the namespace as needed for mapping to my project interface. </p>
  
  <p>Please let me know if this is feasible to do this and if yes then how could I achieve this in spring integration.</p>
  
  <p>Thanks,
  Vinay Agrawal</p>
  
  <p>I tried to do the same as below but getting error IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.ClassNotFoundException: org.springframework.integration.MessagingException: Please see the below configuration done to achieve this purpose:</p>
  
  <pre><code>&lt;int:gateway id="test1SoapESBGateway" service-interface="com.test1.test2.testServiceSoap"&gt;
      &lt;int:method name="testResponse" request-channel="test1ESBRequestChannel" request-timeout="${soap.requestTimeout}" reply-timeout="${soap.replyTimeout}" /&gt;
  &lt;/int:gateway&gt;
  
  &lt;int-xml:marshalling-transformer marshaller="marshaller" input-channel="test1ESBRequestChannel" output-channel="test2ESBResponseChannel"&gt;&lt;/int-xml:marshalling-transformer&gt;
  
  &lt;int:transformer input-channel="test2ESBResponseChannel" output-channel="test2ESBTransformedResponseChannel" ref="changeNamespaceTransformerBean"
      method="transformNamespace"&gt;&lt;/int:transformer&gt;
  
  &lt;bean id="changeNamespaceTransformerBean" class="com.test1.test2.ChangeNamespaceTransformerImpl"&gt;&lt;/bean&gt;
  
  &lt;int-ws:outbound-gateway id="ws-test1SoapESB-gateway" request-channel="test2ESBTransformedResponseChannel" uri="${soap.test1URI}"&gt;
  &lt;/int-ws:outbound-gateway&gt;
  
  &lt;bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"&gt;
  &lt;property name="contextPaths"&gt;
      &lt;list&gt;
          &lt;value&gt;com.test1.test2.model&lt;/value&gt;
      &lt;/list&gt;
  &lt;/property&gt;
  </code></pre>
  
  <p>as above, I am getting the java object payload from testServiceSoap interface method testResponse and then trying to process this payload using int-xml:marshalling-transformer as per of your previous suggestion and then passing this into int:transformer where I want to change my soap namespace from <a href="http://www.test1.com/test2" rel="nofollow">http://www.test1.com/test2</a> to something like <a href="http://www.test4.com/test3" rel="nofollow">http://www.test4.com/test3</a> but I am getting the below exception when trying to deploy the war file into the server:</p>
  
  <p>Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.ClassNotFoundException: org.springframework.integration.MessagingException. Please see server.log for more details. </p>
  
  <p>ChangeNamespaceTransformerImpl definition is as below:</p>
  
  <p>ublic class ChangeNamespaceTransformerImpl {</p>
  
  <pre><code>public ChangeNamespaceTransformerImpl() {
  }
  
  public ChangeNamespaceTransformerImpl(DOMSource payload) {
      this.payload = payload;
  }
  
  
  public DOMSource transformNamespace(DOMSource payload) 
          {
      DOMSource result = payload;
      return result;
      }
  </code></pre>
  
  <p>Please let me know if I am missing something. I was considering that after applying int-xml:marshalling-transformer and then int:transformer, I should be able to do changes in my bean ChangeNamespaceTransformerImpl defined in int:transformer and there I should have the way to replace the namespace since payload will be in xml format.</p>
  
  <p>Please provide your input/suggestion.</p>