关于web service 接口头部验证问题

lmkght 2018-08-14 12:27:39
我使用SOAPHeaderElement 添加头部验证信息, 但是添加后的xml格式自带属性,怎么才能删掉这些自带的属性
比如我添加完的头部信息是:
<wsse:Security soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><wsse:UsernameToken xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:wsse="http://siebel.com/">
<wsse:Username xsi:type="xsd:string" xmlns:wsse="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">FENGJX</wsse:Username>
<wsse:Password xsi:type="xsd:string" xmlns:wsse="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">FENGJX</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>

怎么样可以变成:
<wsse:Security soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><wsse:UsernameToken xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility">
<wsse:Username>FENGJX</wsse:Username>
<wsse:Password>FENGJX</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>

将username和password标签自带的属性删除 试过removeAttribute() 但是删不掉
...全文
166 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧