我想改变
tracks
到
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
我正在使用Mule和CXF。我们正在公开SOAP服务,而wsdl来自遗留系统(我们导入它并生成类)。有必要将前缀从'soap'更改为's'。我看到这可能是一个拦截器,但由于某种原因,我不能让它工作。这是拦截器的代码:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
此外,我可以更改响应中的模式的前缀吗?
答案 0 :(得分:3)
经过一些测试后,它起作用了。它可能看起来非常愚蠢而且我的下巴有几次,我重新开始,清理所有现金,重建并且看起来像拦截器当我添加一条额外的线时,这是难以置信的,我知道:
package se.comaround.interceptors;
import java.util.HashMap;
import java.util.Map;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
import org.apache.cxf.phase.Phase;
public class ComAroundSoapResponceInterceptor
extends AbstractSoapInterceptor {
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.put("soap.env.ns.map", hmap);
message.put("disable.outputstream.optimization", true)
}
}
我不得不喝点咖啡,花一些时间才能得到咖啡,这实际上就是这样。所以,或多或少他们在这里建议: