title: Modifying incoming webservice response with CXF transform feature
body: <p>I am making a call to an external webservice and the faultcode that is returned seems to be causing some trouble for CXF. The response is as follows :</p>
  <pre><code>    &lt;soap:Envelope xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;soap:Body&gt;&lt;soap:Fault&gt;&lt;faultcode&gt;S:Server&lt;/faultcode&gt;&lt;faultstring&gt;Something serious wen wrong&lt;/faultstring&gt;&lt;/soap:Fault&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;
  </code></pre>
  <p>CXF has trouble with this because of the S:Server not being valid. The resulting error is</p>
  <pre><code>    java.lang.RuntimeException: Invalid QName in mapping: S:Server
  </code></pre>
  <p>I am trying to use the CXF Transform feature to change the faultcode but I cannot seem to get it working correctly. The desired output should be:</p>
  <pre><code>    &lt;soap:Envelope xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;soap:Body&gt;&lt;soap:Fault&gt;&lt;faultcode&gt;soap:Server&lt;/faultcode&gt;&lt;faultstring&gt;Something serious wen wrong&lt;/faultstring&gt;&lt;/soap:Fault&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;
  </code></pre>
  <p>I have had a look at <a href="http://cxf.apache.org/docs/transformationfeature.html" rel="nofollow noreferrer">CXF Transform Feature</a> and tried the following in my code :</p>
  <pre><code>    BindingProvider bp = (BindingProvider) port;
      bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);
      Client client = ClientProxy.getClient(port);
      Map&lt;String, String&gt; inTransformMap = Collections.singletonMap(&quot;faultcode&quot;, &quot;faultcode=soap:Server&quot;);
      org.apache.cxf.feature.StaxTransformFeature staxTransformFeature = new org.apache.cxf.feature.StaxTransformFeature();
      staxTransformFeature.setInAppendElements(inTransformMap);
      staxTransformFeature.initialize(client, client.getBus());
  </code></pre>
  <p>This does not seem to replace the faultcode. I have also tried other variations like</p>
  <ol>
  <li>staxTransformFeature.setInTransformElements(inTransformMap)</li>
  <li>inTransformMap = Collections.singletonMap(&quot;{}faultcode&quot;, &quot;{}faultcode=soap:Server&quot;);
  but with no luck.</li>
  </ol>
  <p>I am unable to find any clear examples showing the usage of the transform feature (eg. input and output xml)</p>
  <p>Please guide me on what I may be doing wrong.</p>
  <p>Thanks in advance.</p>