This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Web Services and the fly likes Why IllegalArgumentException is being thrown? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "Why IllegalArgumentException is being thrown?" Watch "Why IllegalArgumentException is being thrown?" New topic
Author

Why IllegalArgumentException is being thrown?

Arsh Ahmad
Greenhorn

Joined: Aug 01, 2008
Posts: 1
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 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' element must contain a: 'http://schemas.xmlsoap.org/soap/envelope/:Body' element.

Can anybody tell me why this exception is being thrown, when the XML clearly has the Body element?
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Why IllegalArgumentException is being thrown?
 
Similar Threads
XML->Data Interchange????
Adding SOAP elements through DOM
Help Building Request Using Apache SOAP
Need help with XML Parsing on SOAP
problem with perl web services and java client