*
* @param message the SOAP message
* @return the RM properties
*/
public RMProperties unmarshalRMProperties(SOAPMessage message) {
RMProperties rmps = new RMPropertiesImpl();
try {
Collection<SequenceAcknowledgement> acks = new ArrayList<SequenceAcknowledgement>();
Collection<AckRequestedType> requested = new ArrayList<AckRequestedType>();
SOAPEnvelope env = message.getSOAPPart().getEnvelope();
SOAPHeader header = env.getHeader();
if (header != null) {
Unmarshaller unmarshaller =
getJAXBContext().createUnmarshaller();
Iterator headerElements = header.examineAllHeaderElements();
while (headerElements.hasNext()) {
SOAPHeaderElement headerElement =
(SOAPHeaderElement)headerElements.next();
Name headerName = headerElement.getElementName();
String localName = headerName.getLocalName();
if (Names.WSRM_NAMESPACE_NAME.equals(headerName.getURI())) {
LOG.log(Level.INFO, "decoding RM header {0}", localName);
if (Names.WSRM_SEQUENCE_NAME.equals(localName)) {
SequenceType s = decodeProperty(SequenceType.class,
headerElement,
unmarshaller);
rmps.setSequence(s);
} else if (Names.WSRM_SEQUENCE_ACK_NAME.equals(localName)) {
SequenceAcknowledgement ack = decodeProperty(SequenceAcknowledgement.class,
headerElement,
unmarshaller);
acks.add(ack);
} else if (Names.WSRM_ACK_REQUESTED_NAME.equals(localName)) {
AckRequestedType ar = decodeProperty(AckRequestedType.class,
headerElement,
unmarshaller);
requested.add(ar);
}
}
}
if (acks.size() > 0) {
rmps.setAcks(acks);
}
if (requested.size() > 0) {
rmps.setAcksRequested(requested);
}
}
} catch (SOAPException se) {
LOG.log(Level.WARNING, "SOAP_HEADER_DECODE_FAILURE_MSG", se);
} catch (JAXBException je) {