你总想不到需求会有多操蛋,要求将报文头:
更改到:
只是名字不同,虽然两个均合法。
第一种方法,基于Spring配置:
只测了发布服务器端时加到 endpoint 结点下可用。
第二种方法,代码直接调用:
只测了客户端连接服务器时可用。
参考地址:http://cxf.547215.n5.nabble.com/How-to-customize-namespaces-position-and-prefix-in-CXF-response-td3423069.html
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
更改到:
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
只是名字不同,虽然两个均合法。
第一种方法,基于Spring配置:
<jaxws:properties>
<entry key="soap.env.ns.map">
<map>
<entry key="SOAP-ENV" value="http://schemas.xmlsoap.org/soap/envelope/"/>
</map>
</entry>
<entry key="disable.outputstream.optimization" value="true"/>
</jaxws:properties>
只测了发布服务器端时加到 endpoint 结点下可用。
第二种方法,代码直接调用:
Client client = ClientProxy.getClient(port);
client.getOutInterceptors();
HashMap<String, String> hmap = new HashMap<String, String>();
hmap.put("SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/");
client.getRequestContext().put("soap.env.ns.map", hmap);
client.getRequestContext().put("disable.outputstream.optimization", "true");
只测了客户端连接服务器时可用。
参考地址:http://cxf.547215.n5.nabble.com/How-to-customize-namespaces-position-and-prefix-in-CXF-response-td3423069.html