You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by "Yang, Gang CTR USA" <ga...@us.army.mil> on 2009/04/15 21:53:15 UTC

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-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


RE: WSSecEncrypt vs WSEncryptBody

Posted by "Yang, Gang CTR US USA" <ga...@us.army.mil>.
Thanks, Colm and others, for the pointers and replies. I was using Axis tools to create the testing SOAP message. After switching to Sun's implementation, the problem went away. I got everything working and the test code was helpful. Thanks again.

Gang

-----Original Message-----
From: Colm O hEigeartaigh [mailto:coheigea@apache.org] 
Sent: Monday, August 16, 2010 3:14 PM
To: Yang, Gang CTR US USA
Cc: wss4j-dev@ws.apache.org
Subject: Re: WSSecEncrypt vs WSEncryptBody

That looks like a problem caused by interned namespaces in XML Security and Axis SAAJ not being able to handle them. Are you using the Axis SAAJ implementation? If so I suggest either use Sun's SAAJ implementation, or else change from using the SAAJ API's to Axis API's.. Take a look at the methods in SOAPUtil:

https://svn.apache.org/repos/asf/webservices/wss4j/trunk/test/wssec/SOAPUtil.java

Colm.

On Wed, Aug 11, 2010 at 3:28 PM, Yang, Gang CTR US USA <ga...@us.army.mil> wrote:
> Hi,
>
> I'm wondering if WSSecEncrypt is ready for use. I was trying to 
> encrypt a very simple SOAP message with a bare minumum wss4j code 
> using either
> 1.5.6 or 1.5.8. Using WSEncryptBody, it worked. But when I switch over 
> to WSSecEncrypt since WSEncryptBody seems to be deprecated, I got the 
> following exception:
>
>
>
> org.apache.ws.security.WSSecurityException: Cannot encrypt data; 
> nested exception is:
>        org.apache.xml.security.exceptions.XMLSecurityException: Cannot 
> create a http://www.w3.org/2000/09/xmldsig#:ds:KeyInfo from a 
> http://www.w3.org/2000/09/xmldsig#:KeyInfo element
>        at
> org.apache.ws.security.message.WSSecEncrypt.doEncryption(WSSecEncrypt.
> ja
> va:583)
>        at
> org.apache.ws.security.message.WSSecEncrypt.doEncryption(WSSecEncrypt.
> ja
> va:444)
>        at
> org.apache.ws.security.message.WSSecEncrypt.encryptForInternalRef(WSSe
> cE
> ncrypt.java:342)
>        at
> org.apache.ws.security.message.WSSecEncrypt.build(WSSecEncrypt.java:30
> 6)
>        at
> com.ibm.sample.SOAPEncryption.encryptSOAPEnvelope(SOAPEncryption.java:
> 13
> 7)
>        at com.ibm.sample.SOAPEncryption.main(SOAPEncryption.java:159)
> Caused by: org.apache.xml.security.exceptions.XMLSecurityException:
> Cannot create a http://www.w3.org/2000/09/xmldsig#:ds:KeyInfo from a 
> http://www.w3.org/2000/09/xmldsig#:KeyInfo element
>        at
> org.apache.xml.security.utils.ElementCheckerImpl$InternedNsChecker.gua
> ra nteeThatElementInCorrectSpace(Unknown Source)
>        at
> org.apache.xml.security.utils.ElementProxy.guaranteeThatElementInCorre
> ct
> Space(Unknown Source)
>        at org.apache.xml.security.utils.ElementProxy.<init>(Unknown
> Source)
>        at
> org.apache.xml.security.utils.SignatureElementProxy.<init>(Unknown
> Source)
>        at org.apache.xml.security.keys.KeyInfo.<init>(Unknown Source)
>        at
> org.apache.ws.security.message.WSSecEncrypt.doEncryption(WSSecEncrypt.
> ja
> va:580)
>        ... 5 more
>
>
>
> Here's the relavent code segment:
>
>
>        public SOAPMessage encryptSOAPEnvelope(SOAPEnvelope
> unsignedEnvelope) throws Exception {
>                // GY: Deprecated. Use WSSecEncrypt //         
> WSEncryptBody wsEncrypt = new WSEncryptBody();
>           WSSecEncrypt wsEncrypt = new WSSecEncrypt();
>           Document doc = unsignedEnvelope.getOwnerDocument();
>
>           String alias = "mykey";
>           String password = "testit";
>           wsEncrypt.setUserInfo(alias, password);
>
>           Crypto crypto = CryptoFactory.getInstance(); //         
> Document encDoc = wsEncrypt.build(doc, crypto);
>           Document encDoc = wsEncrypt.build(doc, crypto, null);
>
>           DOMSource src = new DOMSource(encDoc);
>           MessageFactory mf = MessageFactory.newInstance();
>           SOAPMessage soapMsg = mf.createMessage();
>           soapMsg.getSOAPPart().setContent(src);
>
>           return soapMsg;
>        }
>
>
> I followed the WSSecEncrypt code to the point where it tries to clone 
> the KeyInfo when it generates the exception. It's at 
> WSSecEncrypt.java:595. This looks like all wss4j internal handling. Is 
> this a bug?
>
> Thanks,
> Gang
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: WSSecEncrypt vs WSEncryptBody

Posted by Colm O hEigeartaigh <co...@apache.org>.
That looks like a problem caused by interned namespaces in XML
Security and Axis SAAJ not being able to handle them. Are you using
the Axis SAAJ implementation? If so I suggest either use Sun's SAAJ
implementation, or else change from using the SAAJ API's to Axis
API's.. Take a look at the methods in SOAPUtil:

https://svn.apache.org/repos/asf/webservices/wss4j/trunk/test/wssec/SOAPUtil.java

Colm.

On Wed, Aug 11, 2010 at 3:28 PM, Yang, Gang CTR US USA
<ga...@us.army.mil> wrote:
> Hi,
>
> I'm wondering if WSSecEncrypt is ready for use. I was trying to encrypt
> a very simple SOAP message with a bare minumum wss4j code using either
> 1.5.6 or 1.5.8. Using WSEncryptBody, it worked. But when I switch over
> to WSSecEncrypt since WSEncryptBody seems to be deprecated, I got the
> following exception:
>
>
>
> org.apache.ws.security.WSSecurityException: Cannot encrypt data; nested
> exception is:
>        org.apache.xml.security.exceptions.XMLSecurityException: Cannot
> create a http://www.w3.org/2000/09/xmldsig#:ds:KeyInfo from a
> http://www.w3.org/2000/09/xmldsig#:KeyInfo element
>        at
> org.apache.ws.security.message.WSSecEncrypt.doEncryption(WSSecEncrypt.ja
> va:583)
>        at
> org.apache.ws.security.message.WSSecEncrypt.doEncryption(WSSecEncrypt.ja
> va:444)
>        at
> org.apache.ws.security.message.WSSecEncrypt.encryptForInternalRef(WSSecE
> ncrypt.java:342)
>        at
> org.apache.ws.security.message.WSSecEncrypt.build(WSSecEncrypt.java:306)
>        at
> com.ibm.sample.SOAPEncryption.encryptSOAPEnvelope(SOAPEncryption.java:13
> 7)
>        at com.ibm.sample.SOAPEncryption.main(SOAPEncryption.java:159)
> Caused by: org.apache.xml.security.exceptions.XMLSecurityException:
> Cannot create a http://www.w3.org/2000/09/xmldsig#:ds:KeyInfo from a
> http://www.w3.org/2000/09/xmldsig#:KeyInfo element
>        at
> org.apache.xml.security.utils.ElementCheckerImpl$InternedNsChecker.guara
> nteeThatElementInCorrectSpace(Unknown Source)
>        at
> org.apache.xml.security.utils.ElementProxy.guaranteeThatElementInCorrect
> Space(Unknown Source)
>        at org.apache.xml.security.utils.ElementProxy.<init>(Unknown
> Source)
>        at
> org.apache.xml.security.utils.SignatureElementProxy.<init>(Unknown
> Source)
>        at org.apache.xml.security.keys.KeyInfo.<init>(Unknown Source)
>        at
> org.apache.ws.security.message.WSSecEncrypt.doEncryption(WSSecEncrypt.ja
> va:580)
>        ... 5 more
>
>
>
> Here's the relavent code segment:
>
>
>        public SOAPMessage encryptSOAPEnvelope(SOAPEnvelope
> unsignedEnvelope) throws Exception {
>                // GY: Deprecated. Use WSSecEncrypt
> //         WSEncryptBody wsEncrypt = new WSEncryptBody();
>           WSSecEncrypt wsEncrypt = new WSSecEncrypt();
>           Document doc = unsignedEnvelope.getOwnerDocument();
>
>           String alias = "mykey";
>           String password = "testit";
>           wsEncrypt.setUserInfo(alias, password);
>
>           Crypto crypto = CryptoFactory.getInstance();
> //         Document encDoc = wsEncrypt.build(doc, crypto);
>           Document encDoc = wsEncrypt.build(doc, crypto, null);
>
>           DOMSource src = new DOMSource(encDoc);
>           MessageFactory mf = MessageFactory.newInstance();
>           SOAPMessage soapMsg = mf.createMessage();
>           soapMsg.getSOAPPart().setContent(src);
>
>           return soapMsg;
>        }
>
>
> I followed the WSSecEncrypt code to the point where it tries to clone
> the KeyInfo when it generates the exception. It's at
> WSSecEncrypt.java:595. This looks like all wss4j internal handling. Is
> this a bug?
>
> Thanks,
> Gang
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


RE: WSSecEncrypt vs WSEncryptBody

Posted by "Dittmann, Werner (NSN - DE/Munich)" <we...@nsn.com>.
Hi,

you cannot simply replace WSEncryptBody with WSSecEncrypt, you need
to add a few lines of code. Please have a look at the test cases
that use WSSecEncrypt in the same way that you try to use.

Regards,
Werner

-----Original Message-----
From: ext Yang, Gang CTR US USA [mailto:gang.yang@us.army.mil] 
Sent: Wednesday, August 11, 2010 4:28 PM
To: wss4j-dev@ws.apache.org
Subject: WSSecEncrypt vs WSEncryptBody

Hi,

I'm wondering if WSSecEncrypt is ready for use. I was trying to encrypt
a very simple SOAP message with a bare minumum wss4j code using either
1.5.6 or 1.5.8. Using WSEncryptBody, it worked. But when I switch over
to WSSecEncrypt since WSEncryptBody seems to be deprecated, I got the
following exception:



org.apache.ws.security.WSSecurityException: Cannot encrypt data; nested
exception is: 
	org.apache.xml.security.exceptions.XMLSecurityException: Cannot
create a http://www.w3.org/2000/09/xmldsig#:ds:KeyInfo from a
http://www.w3.org/2000/09/xmldsig#:KeyInfo element
	at
org.apache.ws.security.message.WSSecEncrypt.doEncryption(WSSecEncrypt.ja
va:583)
	at
org.apache.ws.security.message.WSSecEncrypt.doEncryption(WSSecEncrypt.ja
va:444)
	at
org.apache.ws.security.message.WSSecEncrypt.encryptForInternalRef(WSSecE
ncrypt.java:342)
	at
org.apache.ws.security.message.WSSecEncrypt.build(WSSecEncrypt.java:306)
	at
com.ibm.sample.SOAPEncryption.encryptSOAPEnvelope(SOAPEncryption.java:13
7)
	at com.ibm.sample.SOAPEncryption.main(SOAPEncryption.java:159)
Caused by: org.apache.xml.security.exceptions.XMLSecurityException:
Cannot create a http://www.w3.org/2000/09/xmldsig#:ds:KeyInfo from a
http://www.w3.org/2000/09/xmldsig#:KeyInfo element
	at
org.apache.xml.security.utils.ElementCheckerImpl$InternedNsChecker.guara
nteeThatElementInCorrectSpace(Unknown Source)
	at
org.apache.xml.security.utils.ElementProxy.guaranteeThatElementInCorrect
Space(Unknown Source)
	at org.apache.xml.security.utils.ElementProxy.<init>(Unknown
Source)
	at
org.apache.xml.security.utils.SignatureElementProxy.<init>(Unknown
Source)
	at org.apache.xml.security.keys.KeyInfo.<init>(Unknown Source)
	at
org.apache.ws.security.message.WSSecEncrypt.doEncryption(WSSecEncrypt.ja
va:580)
	... 5 more



Here's the relavent code segment:


	public SOAPMessage encryptSOAPEnvelope(SOAPEnvelope
unsignedEnvelope) throws Exception {
		// GY: Deprecated. Use WSSecEncrypt
//	   WSEncryptBody wsEncrypt = new WSEncryptBody();
	   WSSecEncrypt wsEncrypt = new WSSecEncrypt();
	   Document doc = unsignedEnvelope.getOwnerDocument();
	   
	   String alias = "mykey"; 
	   String password = "testit";
	   wsEncrypt.setUserInfo(alias, password);

	   Crypto crypto = CryptoFactory.getInstance();
//	   Document encDoc = wsEncrypt.build(doc, crypto);
	   Document encDoc = wsEncrypt.build(doc, crypto, null);
	
	   DOMSource src = new DOMSource(encDoc);
	   MessageFactory mf = MessageFactory.newInstance();
	   SOAPMessage soapMsg = mf.createMessage();
	   soapMsg.getSOAPPart().setContent(src);
	
	   return soapMsg;
	}


I followed the WSSecEncrypt code to the point where it tries to clone
the KeyInfo when it generates the exception. It's at
WSSecEncrypt.java:595. This looks like all wss4j internal handling. Is
this a bug?

Thanks,
Gang

---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


WSSecEncrypt vs WSEncryptBody

Posted by "Yang, Gang CTR US USA" <ga...@us.army.mil>.
Hi,

I'm wondering if WSSecEncrypt is ready for use. I was trying to encrypt
a very simple SOAP message with a bare minumum wss4j code using either
1.5.6 or 1.5.8. Using WSEncryptBody, it worked. But when I switch over
to WSSecEncrypt since WSEncryptBody seems to be deprecated, I got the
following exception:



org.apache.ws.security.WSSecurityException: Cannot encrypt data; nested
exception is: 
	org.apache.xml.security.exceptions.XMLSecurityException: Cannot
create a http://www.w3.org/2000/09/xmldsig#:ds:KeyInfo from a
http://www.w3.org/2000/09/xmldsig#:KeyInfo element
	at
org.apache.ws.security.message.WSSecEncrypt.doEncryption(WSSecEncrypt.ja
va:583)
	at
org.apache.ws.security.message.WSSecEncrypt.doEncryption(WSSecEncrypt.ja
va:444)
	at
org.apache.ws.security.message.WSSecEncrypt.encryptForInternalRef(WSSecE
ncrypt.java:342)
	at
org.apache.ws.security.message.WSSecEncrypt.build(WSSecEncrypt.java:306)
	at
com.ibm.sample.SOAPEncryption.encryptSOAPEnvelope(SOAPEncryption.java:13
7)
	at com.ibm.sample.SOAPEncryption.main(SOAPEncryption.java:159)
Caused by: org.apache.xml.security.exceptions.XMLSecurityException:
Cannot create a http://www.w3.org/2000/09/xmldsig#:ds:KeyInfo from a
http://www.w3.org/2000/09/xmldsig#:KeyInfo element
	at
org.apache.xml.security.utils.ElementCheckerImpl$InternedNsChecker.guara
nteeThatElementInCorrectSpace(Unknown Source)
	at
org.apache.xml.security.utils.ElementProxy.guaranteeThatElementInCorrect
Space(Unknown Source)
	at org.apache.xml.security.utils.ElementProxy.<init>(Unknown
Source)
	at
org.apache.xml.security.utils.SignatureElementProxy.<init>(Unknown
Source)
	at org.apache.xml.security.keys.KeyInfo.<init>(Unknown Source)
	at
org.apache.ws.security.message.WSSecEncrypt.doEncryption(WSSecEncrypt.ja
va:580)
	... 5 more



Here's the relavent code segment:


	public SOAPMessage encryptSOAPEnvelope(SOAPEnvelope
unsignedEnvelope) throws Exception {
		// GY: Deprecated. Use WSSecEncrypt
//	   WSEncryptBody wsEncrypt = new WSEncryptBody();
	   WSSecEncrypt wsEncrypt = new WSSecEncrypt();
	   Document doc = unsignedEnvelope.getOwnerDocument();
	   
	   String alias = "mykey"; 
	   String password = "testit";
	   wsEncrypt.setUserInfo(alias, password);

	   Crypto crypto = CryptoFactory.getInstance();
//	   Document encDoc = wsEncrypt.build(doc, crypto);
	   Document encDoc = wsEncrypt.build(doc, crypto, null);
	
	   DOMSource src = new DOMSource(encDoc);
	   MessageFactory mf = MessageFactory.newInstance();
	   SOAPMessage soapMsg = mf.createMessage();
	   soapMsg.getSOAPPart().setContent(src);
	
	   return soapMsg;
	}


I followed the WSSecEncrypt code to the point where it tries to clone
the KeyInfo when it generates the exception. It's at
WSSecEncrypt.java:595. This looks like all wss4j internal handling. Is
this a bug?

Thanks,
Gang

---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


RE: SOAPElement expected exception with working with JBossWS

Posted by Colm O hEigeartaigh <co...@progress.com>.
Hi Gang,

I've fixed this on trunk and on the 1_5_x-fixes branch. Unfortunately
it's too late to get it into the 1.5.7 release. Can you let me know if
the fix is working ok for you?

Colm.

-----Original Message-----
From: Yang, Gang CTR USA [mailto:gang.yang@us.army.mil] 
Sent: 16 April 2009 19:56
To: Colm O hEigeartaigh; wss4j-dev@ws.apache.org
Subject: RE: SOAPElement expected exception with working with JBossWS

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:coheigea@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.yang@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-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


RE: SOAPElement expected exception with working with JBossWS

Posted by "Yang, Gang CTR USA" <ga...@us.army.mil>.
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:coheigea@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.yang@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-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


RE: SOAPElement expected exception with working with JBossWS

Posted by Colm O hEigeartaigh <co...@progress.com>.
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.yang@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-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org