好吧,如果其他人面临这种错误,下面这个方法对我有用。 <击> 我不记得我发现了什么,但感谢主人。 击> 。谢谢 他 。
void addWsSecurityHeader(org.apache.axis.client.Stub binding, String wsUser,String wsPass)throws SOAPException { // Create the top-level WS-Security SOAP header XML name. QName headerName = new QName("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "Security"); SOAPHeaderElement header = new SOAPHeaderElement(headerName); // no intermediate actors are involved. header.setActor(null); // not important, "wsse" is standard header.setPrefix("wsse"); header.setMustUnderstand(true); // Add the UsernameToken element to the WS-Security header SOAPElement utElem = header.addChildElement("UsernameToken"); SOAPElement userNameElem = utElem.addChildElement("Username"); userNameElem.removeContents(); userNameElem.setValue(wsUser); SOAPElement passwordElem = utElem.addChildElement("Password"); passwordElem.setValue(wsPass); // Finally, attach the header to the binding. binding.setHeader(header); }
也用于追踪我发送和接收我使用的 这个