Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why IllegalArgumentException is being thrown?  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an XML Document consisting of SOAP Envelope and SOAP Body elements which is unmarshalled into a SOAP Envelope using the following code:

mEnv = org.apache.soap.Envelope.unmarshall(parentDoc.getDocumentElement());

where parentDoc contains the XML Document. This works fine.

But now I have added code to create a new Document consisting of a SOAP Header element which is added to parentDoc using the following:

parentRoot.insertBefore(hdrNode, bodyElem);

At this point the XML Document looks like the following:

But when unmarshalling this using the following code again:

mEnv = org.apache.soap.Envelope.unmarshall(parentDoc.getDocumentElement());

throws the following exception:

java.lang.IllegalArgumentException: An '' element must contain a: '' element.

Can anybody tell me why this exception is being thrown, when the XML clearly has the Body element?
You have to be odd to be #1 - Seuss. An odd little ad:
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!