//TestHeader5 return Header
Method testHeader5 = SOAPMessageUtil.getMethod(TestHeader.class, "testHeader5");
assertNotNull(testHeader5);
objContext.setMethod(testHeader5);
TestHeader5 arg2 = new TestHeader5();
arg2.setRequestType("HeaderVal5");
objContext.setMessageObjects(new Object[0]);
objContext.setReturn(arg2);
//Write the SOAP Headers for testHeader5 operation - tests headers as return.
binding.marshal(
objContext,
soapContext,
new JAXBDataBindingCallback(testHeader5,
DataBindingCallback.Mode.PARTS,
null));
msg = soapContext.getMessage();
assertNotNull(msg);
//Test the Header Part Only
assertNotNull(msg.getSOAPHeader());
assertTrue(msg.getSOAPHeader().hasChildNodes());
list = msg.getSOAPHeader().getChildNodes();
assertEquals(1, list.getLength());
headerElement = (Element)list.item(0);
//Check for mustUndrstand Attribute
assertEquals("true", headerElement
.getAttributeNS(SOAPConstants.HEADER_MUSTUNDERSTAND.getNamespaceURI(),
SOAPConstants.HEADER_MUSTUNDERSTAND.getLocalPart()));
//TestHeader5 has child elements.
assertTrue(headerElement.hasChildNodes());
list = headerElement.getChildNodes();
assertEquals(1, list.getLength());
assertEquals(arg2.getRequestType(), list.item(0).getFirstChild().getNodeValue());
}