I have one WebService installed on JBOSS EAP 6.2. Problem appears when i want to fetch SOAP headers.
Code, where exception is raised:
ArrayList<SoapHeader> hl = (ArrayList<SoapHeader>) wsctx.getMessageContext().get("org.apache.cxf.headers.Header.list");
String username = "";
String password = "";
for (int i = 0; i < hl.size(); i++) { //for(SoapHeader header : hl) gives this same exception
SoapHeader header = hl.get(i);
//here is fetching data from this header. Not important to this case.
}
I know it isn't really pretty, but i really interested in fetching header and exception raised percisely in this method:
hl.get(i)
And message of exception is:
org.apache.cxf.binding.soap.SoapHeader cannot be cast to org.apache.cxf.binding.soap.SoapHeader
At first i thought about wrong version in my Maven's POM file so:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-soap</artifactId>
<version>2.4.2</version>
</dependency>
But it work good i think.
So my question: how to avoid it? Can anyone help me? Thanks