1 16 package org.apache.axis2.saaj; 17 18 import junit.framework.TestCase; 19 20 import javax.xml.soap.SOAPElement ; 21 import java.util.Iterator ; 22 23 27 public class HeadersTest extends TestCase { 28 29 private final String actor = "ACTOR#1"; 30 private final String localName = "Local1"; 31 private final String namespace = "http://ws.apache.org"; 32 private final String prefix = "P1"; 33 34 public HeadersTest(String name) { 35 super(name); 36 } 37 38 public void testAddingHeaderElements() throws Exception { 39 javax.xml.soap.SOAPMessage soapMessage = javax.xml.soap.MessageFactory.newInstance().createMessage(); 40 javax.xml.soap.SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope(); 41 javax.xml.soap.SOAPHeader header = soapEnv.getHeader(); 42 header.addChildElement("ebxmlms"); 43 44 48 49 Iterator it = header.getChildElements(); 50 boolean b = false; 51 while(it.hasNext()){ 52 SOAPElement el = (SOAPElement ) it.next(); 53 String lName = el.getNodeName(); 54 if(lName.equalsIgnoreCase("ebxmlms")){ 55 b = true; 56 break; 57 } 58 } 59 assertTrue(b); 60 } 61 62 } 63 | Popular Tags |