}
private void verifyHeaders(SOAPMessageContext context, String... names) throws SOAPException {
SOAPMessage message = context.getMessage();
SOAPEnvelope env = message.getSOAPPart().getEnvelope();
SOAPHeader header = env.getHeader();
// check all expected headers are present
for (String name : names) {
boolean found = false;
Iterator headerElements = header.examineAllHeaderElements();
while (headerElements.hasNext()) {
SOAPHeaderElement headerElement = (SOAPHeaderElement)headerElements.next();
Name headerName = headerElement.getElementName();
String localName = headerName.getLocalName();
if (headerName.getURI().equals(RMUtils.getRMConstants().getNamespaceURI())
&& localName.equals(name)) {
found = true;
break;
} else if (headerName.getURI().equals(
org.objectweb.celtix.bus.ws.addressing.Names.WSA_NAMESPACE_NAME)
&& localName.equals(name)) {
found = true;
break;
}
}
assertTrue("Could not find header element " + name, found);
}
// no other headers should be present
Iterator headerElements = header.examineAllHeaderElements();
while (headerElements.hasNext()) {
SOAPHeaderElement headerElement = (SOAPHeaderElement)headerElements.next();
Name headerName = headerElement.getElementName();
String localName = headerName.getLocalName();
assertTrue(RMUtils.getRMConstants().getNamespaceURI().equals(headerName.getURI())