I am trying to change
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
to
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
I am using Mule and CXF. We are exposing a SOAP service and the wsdl is from a legacy system (we imported it and generated the classes). It is necessary to change the prefix from 'soap' to just 's'. I see that this is possible with an Interceptor, but for some reason I cant make it work. Here is the code for my interceptor:
package se.comaround.interceptors;
import java.util.HashMap;
import java.util.Map;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
public class ComAroundSoapResponceInterceptor extends
AbstractPhaseInterceptor<SoapMessage> {
public ComAroundSoapResponceInterceptor() {
super(Phase.PREPARE_SEND);
}
public void handleMessage(SoapMessage message) {
Map<String, String> hmap = new HashMap<String, String>();
hmap.put("s", "http://schemas.xmlsoap.org/soap/envelope/");
message.setContextualProperty("soap.env.ns.map", hmap);
message.setContextualProperty("disable.outputstream.optimization", true);
System.out.println("Set up");
}
}
Furthermore, can I change the prefixes for the schemas inside the response?