//TestHeader3 InOutHeader
Method testHeader3 = SOAPMessageUtil.getMethod(TestHeader.class, "testHeader3");
assertNotNull(testHeader3);
objContext.setMethod(testHeader3);
TestHeader3 arg0 = new TestHeader3();
TestHeader3 arg1 = new TestHeader3();
arg1.setRequestType("HeaderVal");
Object[] args = SOAPMessageUtil.getMessageObjects(testHeader3, arg0, arg1);
objContext.setMessageObjects(args);
//Write soap headers for testHeader3 operation - tests inout headers
binding.marshal(
objContext,
soapContext,
new JAXBDataBindingCallback(testHeader3,
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);
//TestHeader3 has no child elements
assertTrue(headerElement.hasChildNodes());
list = headerElement.getChildNodes();
assertEquals(1, list.getLength());
headerElement = (Element)list.item(0);
assertTrue(headerElement.hasChildNodes());
list = headerElement.getChildNodes();
assertEquals(1, list.getLength());
Text text = (Text)list.item(0);
assertEquals(arg1.getRequestType(), text.getData());
}