Getting DOM Exception

sabiya kazi <[email protected]>
Newsgroups gmane.text.xml.axis.user
Message-ID <CAGxmxE3P10qYYEPovki1mOhNmpQPe6ZOxpYc_ExCG-9Nx2S9gg@mail.gmail.com>
Hi,
   I am getting an exception while executing following code snippet
I have added all the dependecies required for axis2-saaj jar.
This is a simple code for creating a SOAP message, still I am getting this
exception
I am not able to figure out this error.

code snippet-->
MessageFactory factory=MessageFactory.newInstance();
     System.out.println(factory.getClass());
 SOAPMessage msg=factory.createMessage();
 msg.writeTo(System.out);
Exception
class org.apache.axis2.saaj.MessageFactoryImpl
Exception in thread "main" org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR:
An attempt was made to insert a node where it is not permitted.
at org.apache.axiom.om.impl.dom.ParentNode.insertBefore(ParentNode.java:235)
at org.apache.axiom.om.impl.dom.NodeImpl.appendChild(NodeImpl.java:240)
at
org.apache.axis2.saaj.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:111)
at com.test.SOAPTest.main(SOAPTest.java:17)

Regards,
Sabiya
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.