Ejemplo n.º 1
0
  @Validated
  @Test
  public void testExamineHeader() {
    SOAPHeaderElement she = null;

    try {
      she1 = hdr.addHeaderElement(envelope.createName("foo1", "f1", "foo1-URI"));
      she1.setActor("actor-URI");
      Iterator iterator = hdr.examineAllHeaderElements();
      int cnt = 0;
      while (iterator.hasNext()) {
        cnt++;
        she = (SOAPHeaderElement) iterator.next();
        if (!she.equals(she1)) {
          fail("SOAP Header Elements do not match");
        }
      }

      if (cnt != 1) {
        fail("SOAPHeaderElement count mismatch: expected 1, received " + cnt);
      }

      iterator = hdr.examineAllHeaderElements();
      if (!iterator.hasNext()) {
        fail("no elements in iterator - unexpected");
      }

    } catch (Exception e) {
      fail("Unexpected Exception: " + e);
    }
  }