1 package org.apache.axis2.om; 2 3 import org.apache.axis2.soap.SOAPEnvelope; 4 import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder; 5 6 import javax.xml.namespace.QName ; 7 8 24 public class OMElementTest extends OMTestCase implements OMConstants { 25 private static final String WSA_URI = "http://schemas.xmlsoap.org/ws/2004/03/addressing"; 26 private static final String WSA_TO = "To"; 27 28 29 public OMElementTest(String testName) { 30 super(testName); 31 } 32 33 36 protected void setUp() throws Exception { 37 38 } 39 40 public void testGetText(){ 41 try { 42 StAXSOAPModelBuilder soapBuilder = getOMBuilder("soap/OMElementTest.xml"); 43 SOAPEnvelope soapEnvelope = (SOAPEnvelope) soapBuilder.getDocumentElement(); 44 OMElement wsaTo = soapEnvelope.getHeader().getFirstChildWithName(new QName (WSA_URI, WSA_TO)); 45 46 String expectedString = "http://localhost:8081/axis/services/BankPort"; 47 assertEquals("getText is not returning the correct value", wsaTo.getText().trim(), expectedString); 48 } catch (Exception e) { 49 e.printStackTrace(); } 51 } 52 53 } 54 | Popular Tags |