如何在Spring-WS中修改默认的SOAP-ENV和ns2命名空间前缀
SOAP命名空间前缀替换
需要将指定SOAP响应中的SOAP-ENV命名空间前缀替换为soapns,ns2前缀替换为tns,具体前后代码如下:
原SOAP响应
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <ns2:Response xmlns:ns2=""> <ns2:RequestReturn> <ns2:COUNTRY_CODE>1</ns2:COUNTRY_CODE> </ns2:RequestReturn> </ns2:Response> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
替换后的目标SOAP响应
<soapns:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <soapns:Header/> <soapns:Body> <tns:Response xmlns:tns=""> <tns:RequestReturn> <tns:COUNTRY_CODE>1</tns:COUNTRY_CODE> </tns:RequestReturn> </tns:Response> </soapns:Body> </soapns:Envelope>
内容的提问来源于stack exchange,提问作者kavish peiris
相关产品推荐
相关产品推荐

