Colm, I tried WSS4J 1.5.6 and it fixed the "SOAPElement expected" problem. However, it still has working with JbossWS's SOAPPart implementation. JBossWS's implementation of Element.appendChild() and Element.insertBefore() creates a new instance of the parameter child, append/insert the new instance and return the new instance. So I had to changed the wss4j's org.apache.ws.security.util.WSSecurityUtil.prependChildElement() method to receive back the appended/inserted child to make it work with JBossWS. The exact changes are:
parent.appendChild(child); Changed to: child = (Element)parent.appendChild(child); parent.insertBefore(child, firstChild); Changed to: child = (Element)parent.insertBefore(child, firstChild); I hope these changes will have your blessing. It would nice if they can be pulled into the code base if you do bless it. Thanks, Gang -----Original Message----- From: Colm O hEigeartaigh [mailto:cohei...@progress.com] Sent: Thursday, April 16, 2009 6:40 AM To: Yang, Gang CTR USA; wss4j-dev@ws.apache.org Subject: RE: SOAPElement expected exception with working with JBossWS Can you try with either WSS4J 1.5.5 or 1.5.6? I removed all of the new-line insertion stuff in 1.5.5. Colm. -----Original Message----- From: Yang, Gang CTR USA [mailto:gang.y...@us.army.mil] Sent: 15 April 2009 20:53 To: wss4j-dev@ws.apache.org Subject: SOAPElement expected exception with working with JBossWS Hi, I'm trying to deploy our application that uses wss4j-1.5.4 into JBoss4.2.2(JBossWS 2.0.1) and getting the following exception: --- java.lang.IllegalArgumentException: SOAPElement expected at org.jboss.ws.core.soap.SOAPHeaderImpl.convertToHeaderElement(SOAPHeaderI mpl.java:286) at org.jboss.ws.core.soap.SOAPHeaderImpl.insertBefore(SOAPHeaderImpl.java:2 04) at org.apache.ws.security.util.WSSecurityUtil.prependChildElement(WSSecurit yUtil.java:580) at org.apache.ws.security.util.WSSecurityUtil.findWsseSecurityHeaderBlock(W SSecurityUtil.java:635) at org.apache.ws.security.message.WSSecHeader.insertSecurityHeader(WSSecHea der.java:160) ...... --- During debugging, I found wss4j is trying to insert a DOM Text node (with content of "\n")into the SOAP header while Jboss SOAPHeaderImpl is testing for SOAPElement. Apparently in Jboss' implementation, Text node is not a subclass of SOAPElement. Has anyone enccoutered the similar problem? What was the solution? Any idea or suggestion is appreciated. BTW, what is wss4j inserting the "\n" into the SOAP header for? Thanks, Gang --------------------------------------------------------------------- To unsubscribe, e-mail: wss4j-dev-unsubscr...@ws.apache.org For additional commands, e-mail: wss4j-dev-h...@ws.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: wss4j-dev-unsubscr...@ws.apache.org For additional commands, e-mail: wss4j-dev-h...@ws.apache.org