在向 SOAPElement 添加新节点时,我得到了一个额外的、不需要的属性 xmlns=""。我该如何解决?
...
SOAPFactory factory = SOAPFactory.newInstance();
SOAPElement securityElem = factory.createElement("Security", null, "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
SOAPElement tokenElem = factory.createElement("UsernameToken");
...
securityElem.addChildElement(tokenElem);
结果:
<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<UsernameToken xmlns=""/> </Security>
但我需要这个:
<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<UsernameToken/> </Security>