1 16 package org.apache.axis2.om; 17 18 import org.apache.axis2.soap.SOAPEnvelope; 19 20 import java.io.File ; 21 22 public class BadInputTest extends OMTestCase { 23 File dir = new File (testResourceDir, "badsoap"); 24 25 public BadInputTest(String testName) { 26 super(testName); 27 } 28 29 30 public void testEnvelopeMissing() throws Exception { 32 try { 33 SOAPEnvelope soapEnvelope = 34 (SOAPEnvelope) OMTestUtils.getOMBuilder(new File (dir, "envelopeMissing.xml")).getDocumentElement(); 35 OMTestUtils.walkThrough(soapEnvelope); 36 fail("this must failed gracefully with OMException or AxisFault"); 37 } catch (OMException e) { 38 return; 39 } 40 41 } 42 43 public void testHeaderBodyWrongOrder() throws Exception { 45 try { 46 SOAPEnvelope soapEnvelope = 47 (SOAPEnvelope) OMTestUtils.getOMBuilder(new File (dir, "haederBodyWrongOrder.xml")).getDocumentElement(); 48 OMTestUtils.walkThrough(soapEnvelope); 49 fail("this must failed gracefully with OMException or AxisFault"); 50 } catch (OMException e) { 51 return; 52 } 53 } 54 55 86 public void testTwoBodymessage() throws Exception { 88 try { 89 SOAPEnvelope soapEnvelope = 90 (SOAPEnvelope) OMTestUtils.getOMBuilder(new File (dir, "twoBodymessage.xml")).getDocumentElement(); 91 OMTestUtils.walkThrough(soapEnvelope); 92 fail("this must failed gracefully with OMException or AxisFault"); 93 } catch (OMException e) { 94 return; 95 } 96 97 } 98 99 public void testTwoheaders() throws Exception { 101 try { 102 SOAPEnvelope soapEnvelope = 103 (SOAPEnvelope) OMTestUtils.getOMBuilder(new File (dir, "twoheaders.xml")).getDocumentElement(); 104 OMTestUtils.walkThrough(soapEnvelope); 105 fail("this must failed gracefully with OMException or AxisFault"); 106 } catch (OMException e) { 107 return; 108 } 109 110 } 111 112 public void testWrongSoapNs() throws Exception { 114 try { 115 SOAPEnvelope soapEnvelope = 116 (SOAPEnvelope) OMTestUtils.getOMBuilder(new File (dir, "wrongSoapNs.xml")).getDocumentElement(); 117 OMTestUtils.walkThrough(soapEnvelope); 118 fail("this must failed gracefully with OMException or AxisFault"); 119 } catch (OMException e) { 120 return; 121 } 122 123 } 124 125 151 152 } 153 | Popular Tags |