QName headerParameterName = new QName("http://schemas.xmlsoap.org/ws/2005/07/securitypolicy", "Header");
QName nameAttributeName = new QName("Name");
QName namespaceAttributeName = new QName("Namespace");
Policy policy = PolicyResourceLoader.loadPolicy("bug_reproduction/securityPolicy1.xml");
AssertionSet alternative = policy.iterator().next();
PolicyAssertion signedParts = alternative.get(new QName("http://schemas.xmlsoap.org/ws/2005/07/securitypolicy", "SignedParts")).iterator().next();
Iterator<PolicyAssertion> iterator = signedParts.getNestedAssertionsIterator();
while (iterator.hasNext()) {
PolicyAssertion assertion = iterator.next();
if (assertion.getName().equals(headerParameterName)) {
System.out.println(assertion.toString());
String nameValue = assertion.getAttributeValue(nameAttributeName);
String namespaceValue = assertion.getAttributeValue(namespaceAttributeName);
System.out.println();
System.out.println("Name value: '" + nameValue + "'");
System.out.println("Namespace value: '" + namespaceValue + "'");
System.out.println("==========================================");
assertNotNull("'Name' attribute of 'Header' parameter is expected to be not null.", nameValue);
assertNotNull("'Namespace' attribute of 'Header' parameter is expected to be not null.", namespaceValue);
}
}