Details
Description
When calling
Object[] getHeaders(QName name, JAXBContext context, boolean allRoles)
In a header, I get an ArrayStoreException. Looking at the code, I've found this at org.apache.cxf.jaxws.handler.soap.SOAPMessageContextImpl.getHeaders(SOAPMessageContextImpl.java:106):
public Object[] getHeaders(QName name, JAXBContext context, boolean allRoles) {
SOAPMessage msg = getMessage();
SOAPHeader header;
try {
header = msg.getSOAPPart().getEnvelope().getHeader();
if (header == null || !header.hasChildNodes())
List<Object> ret = new ArrayList<Object>();
Iterator<SOAPHeaderElement> it = CastUtils.cast(header.examineAllHeaderElements());
while (it.hasNext()) {
SOAPHeaderElement she = it.next();
if ((allRoles
roles.contains(she.getActor())) && name.equals(she.getElementQName())) { ret.add(context.createUnmarshaller().unmarshal(she)); } } |
---|
ret is a list of objects that gets populated with unmarshalled elements. In the return statement it tries to cast it to an array of SOAPHeaderElement, but the elements inside are not SOAPHeaderElement so it throws the aforementioned exception.