Hi, You need to call WSSConfig.init() before any call to org.apache.xml.security.Init.init(). For example see:
https://github.com/apache/ws-wss4j/blob/4c5dda00904ea7217b4e0add80024973313466ea/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureWSS651Test.java#L65 Colm. On Wed, Mar 15, 2023 at 9:08 AM Sreenivas Somavarapu <soma.sreeni...@gmail.com> wrote: > > Hi Team, > > > > <<Resending incase if original mail not delivered>> > > While using org.apache.wss4j.common.token.SecurityTokenReference (Currently > using wss4j 2.3.2 and xmlsec 2.2.3) constructor in one of our tests we are > getting below exception. There is no functional impact due to this error but > it refers to some string missing in properties file which we think is > incorrect and it suppress actual cause of the issue. Wanted to know if > anything else needs to be done before calling the below code (like WSS4J > initialization or something else)? > > > > org.apache.wss4j.common.ext.WSSecurityException: No message with ID > "badElement" found in resource bundle > "org/apache/xml/security/resource/xmlsecurity" > > > > Code snippet > > org.apache.xml.security.Init.init(); > > String xmlContent > > = "<wsse:Security > xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" > \r\n" > > + " > xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">\r\n" > > + " <wsse:UsernameToken > wsu:Id=\"usernametoken\">\r\n" > > + " > <wsse:Username>user1025</wsse:Username>\r\n" > > + " > <wsse:Password>user1025</wsse:Password>\r\n" + " > </wsse:UsernameToken>\r\n" > > + " </wsse:Security>"; > > DocumentBuilderFactory documentBuilderFactory = > DocumentBuilderFactory.newInstance(); > > documentBuilderFactory.setNamespaceAware(true); > > Document doc = documentBuilderFactory.newDocumentBuilder().parse(new > InputSource(new StringReader(xmlContent))); > > > > SecurityTokenReference secTokRef = new > SecurityTokenReference(doc.getDocumentElement(), new BSPEnforcer(false)); > > > > Regards, > > Sreenivas > > > > --------------------------------------------------------------------- To > unsubscribe, e-mail: dev-unsubscr...@ws.apache.org For additional commands, > e-mail: dev-h...@ws.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@ws.apache.org For additional commands, e-mail: dev-h...@ws.apache.org