Messaging { public static SOAPHeaderBlock getElement(final SOAPEnvelope env) { SOAPHeaderBlock messaging = null; try { messaging = (SOAPHeaderBlock) env.getHeader().getFirstChildWithName(Q_ELEMENT_NAME); } catch (final Exception ex) { messaging = null; } return messaging; }  static SOAPHeaderBlock createElement(final org.apache.axiom.soap.SOAPEnvelope env); static SOAPHeaderBlock getElement(final SOAPEnvelope env); static final QName Q_ELEMENT_NAME; }
@Test public void testGetElement() throws Exception { SOAPEnvelope env = SOAPEnv.createEnvelope(SOAPEnv.SOAPVersion.SOAP_12); SOAPHeaderBlock soapHeaderBlock = Messaging.createElement(env); SOAPHeaderBlock newSoapHeaderBlock = Messaging.getElement(env); assertEquals(soapHeaderBlock.getMustUnderstand(), newSoapHeaderBlock.getMustUnderstand()); assertEquals(soapHeaderBlock.getRelay(), newSoapHeaderBlock.getRelay()); assertEquals(soapHeaderBlock.getRole(), newSoapHeaderBlock.getRole()); assertEquals(soapHeaderBlock.getVersion(), newSoapHeaderBlock.getVersion()); }