You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 12:05:17