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