1 16 17 package org.apache.axis2.soap; 18 19 import org.apache.axis2.soap.impl.llom.SOAPConstants; 20 import org.apache.axis2.soap.impl.llom.soap11.SOAP11Constants; 21 import org.apache.axis2.soap.impl.llom.soap12.SOAP12Constants; 22 23 public class SOAPEnvelopeTest extends SOAPTestCase { 24 protected SOAPEnvelope soap11Envelope; 25 protected SOAPEnvelope soap12Envelope; 26 27 public SOAPEnvelopeTest(String testName) { 28 super(testName); 29 soap11Envelope = soap11Factory.getDefaultEnvelope(); 30 soap12Envelope = soap12Factory.getDefaultEnvelope(); 31 } 32 33 public void testSOAP11GetHeader() { 35 SOAPHeader header = soap11Envelope.getHeader(); 36 assertTrue("SOAP 1.1 Header Test : - Header local name mismatch", header.getLocalName().equals(SOAPConstants.HEADER_LOCAL_NAME)); 37 assertTrue("SOAP 1.1 Header Test : - Header namespace mismatch", header.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)); 38 } 39 40 public void testSOAP11GetBody() { 41 SOAPBody body = soap11Envelope.getBody(); 42 assertTrue("SOAP 1.1 Body Test : - Body local name mismatch", body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME)); 43 assertTrue("SOAP 1.1 Body Test : - Body namespace mismatch", body.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)); 44 } 45 46 public void testSOAP12GetHeader() { 48 SOAPHeader header = soap12Envelope.getHeader(); 49 assertTrue("SOAP 1.2 Header Test : - Header local name mismatch", header.getLocalName().equals(SOAPConstants.HEADER_LOCAL_NAME)); 50 assertTrue("SOAP 1.2 Header Test : - Header namespace mismatch", header.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)); 51 } 52 53 public void testSOAP12GetBody() { 54 SOAPBody body = soap12Envelope.getBody(); 55 assertTrue("SOAP 1.2 Body Test : - Body local name mismatch", body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME)); 56 assertTrue("SOAP 1.2 Body Test : - Body namespace mismatch", body.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)); 57 } 58 59 public void testSOAP11GetHeaderWithParser() { 61 SOAPHeader header = soap11EnvelopeWithParser.getHeader(); 62 assertTrue("SOAP 1.1 Header Test : - Header local name mismatch", header.getLocalName().equals(SOAPConstants.HEADER_LOCAL_NAME)); 63 assertTrue("SOAP 1.1 Header Test : - Header namespace mismatch", header.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)); 64 } 65 66 public void testSOAP11GetBodyWithParser() { 67 SOAPBody body = soap11EnvelopeWithParser.getBody(); 68 assertTrue("SOAP 1.1 Body Test : - Body local name mismatch", body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME)); 69 assertTrue("SOAP 1.1 Body Test : - Body namespace mismatch", body.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)); 70 } 71 72 public void testSOAP12GetHeaderWithParser() { 74 SOAPHeader header = soap12EnvelopeWithParser.getHeader(); 75 assertTrue("SOAP 1.2 Header Test : - Header local name mismatch", header.getLocalName().equals(SOAPConstants.HEADER_LOCAL_NAME)); 76 assertTrue("SOAP 1.2 Header Test : - Header namespace mismatch", header.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)); 77 } 78 79 public void testSOAP12GetBodyWithParser() { 80 SOAPBody body = soap12EnvelopeWithParser.getBody(); 81 assertTrue("SOAP 1.2 Body Test : - Body local name mismatch", body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME)); 82 assertTrue("SOAP 1.2 Body Test : - Body namespace mismatch", body.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)); 83 } 84 } 85 | Popular Tags |