Description
We were using axis2 1.7.9 and axiom 1.2.22 in our application along with commons-httpclient 3.1. We tried removing commons-httpclient 3.1 from our application and since commons-httpclient is required by axis2 1.7.9 we had to upgrade axis2 to its latest version 1.8.0 and in process of upgrading axis2 to 1.8.0 we also upgraded axiom to 1.3.0 but when we are running our application we get below error.
org.apache.axiom.soap.SOAPProcessingException: org.apache.axiom.om.impl.llom.OMElementImpl is not allowed as a child of org.apache.axiom.soap.impl.llom.soap11.SOAP11HeaderImpl at org.apache.axiom.soap.impl.mixin.AxiomSOAPElementSupport.ajc$interMethod$org_apache_axiom_soap_impl_mixin_AxiomSOAPElementSupport$org_apache_axiom_soap_impl_intf_AxiomSOAPElement$checkChild(AxiomSOAPElementSupport.aj:35) at org.apache.axiom.soap.impl.llom.SOAPElement.checkChild(SOAPElement.java:1) at org.apache.axiom.om.impl.mixin.AxiomContainerSupport.ajc$interMethod$org_apache_axiom_om_impl_mixin_AxiomContainerSupport$org_apache_axiom_om_impl_intf_AxiomContainer$prepareNewChild(AxiomContainerSupport.aj:160) at org.apache.axiom.om.impl.llom.OMElementImpl.prepareNewChild(OMElementImpl.java:1) at org.apache.axiom.om.impl.mixin.AxiomContainerSupport.ajc$interMethodDispatch1$org_apache_axiom_om_impl_mixin_AxiomContainerSupport$org_apache_axiom_om_impl_intf_AxiomContainer$prepareNewChild(AxiomContainerSupport.aj) at org.apache.axiom.om.impl.mixin.AxiomContainerSupport.ajc$interMethod$org_apache_axiom_om_impl_mixin_AxiomContainerSupport$org_apache_axiom_om_impl_intf_AxiomContainer$addChild(AxiomContainerSupport.aj:166) at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:1) at org.apache.axis2.client.ServiceClient.addHeadersToEnvelope(ServiceClient.java:673)
I am not sure why above exception is thrown and how to fix it.
As per our understanding , may be it helps -
we changed axiom-1.2.31 to axiom-1.3.0 which is latest but there is code issue in org.apache.axiom.om.impl.llom.OMElementImpl as addChild method is missing.
Code 1.2.31 - addchild method - https://jar-download.com/artifacts/org.apache.ws.commons.axiom/axiom-impl/1.2.5/source-code/org/apache/axiom/om/impl/llom/OMElementImpl.java
code 1.3.0 - addchild method- https://jar-download.com/artifacts/org.apache.ws.commons.axiom/axiom-impl/1.3.0/source-code/org/apache/axiom/om/impl/llom/OMElementImpl.java
while the consumer of this method is same - _addHeadersToEnvelope_ in both the version