【发布时间】:2015-07-16 20:48:46
【问题描述】:
我正在尝试改变
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
到
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
我正在使用 Mule 和 CXF。我们公开了一个 SOAP 服务,而 wsdl 来自一个遗留系统(我们导入了它并生成了类)。有必要将前缀从“soap”更改为“s”。我看到拦截器可以做到这一点,但由于某种原因,我无法让它工作。这是我的拦截器的代码:
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");
}
}
此外,我可以更改响应中架构的前缀吗?
【问题讨论】:
标签: soap cxf mule mule-studio