我需要删除所有命名空间前缀" bim"在以下肥皂请求中。我如何在soap处理程序handleMessage中执行此操作?
<bim:AuthorizationInfo>
<!--Optional:-->
<bim:ApplicationId>123</bim:ApplicationId>
<!--Optional:-->
<bim:UserId>123</bim:UserId>
<!--Optional:-->
<bim:Userid>123</bim:Userid>
<bim:Password>123</bim:Password>
</bim:AuthorizationInfo>
此代码无效:
SOAPMessage soapMsg = context.getMessage();
SOAPEnvelope envelope = soapMsg.getSOAPPart().getEnvelope();
javax.xml.soap.SOAPBody body = envelope.getBody();
@SuppressWarnings("rawtypes")
Iterator iter = body.getChildElements();
while (iter.hasNext()) {
Object object = iter.next();
if (object instanceof SOAPElement) {
SOAPElement element = (SOAPElement) object;
element.removeNamespaceDeclaration(element.getPrefix());
element.setPrefix("");
}
}