FileDocCategorySizeDatePackage
TestExceptions.javaAPI DocApache Axis 1.41869Sat Apr 22 18:57:28 BST 2006test.soap12

TestExceptions

public class TestExceptions extends test.GenericLocalTest
Ensure that SOAP 1.2's FAULT_SUBCODE_PROC_NOT_PRESENT is thrown if the method is not found

Fields Summary
Constructors Summary
public TestExceptions()

        super("foo");
    
public TestExceptions(String s)

        super(s);
    
Methods Summary
public java.lang.Stringecho()
Service method. Returns a string

return
a string

        return "hello world";
    
public voidtestEcho()
base test ensure that SOAP1.2 works :)

throws
Exception

        Object result = null;
        Call call = getCall();
        call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS);
        result = call.invoke("echo", null);
        assertEquals(result.toString(), "hello world");
	
public voidtestNoSuchProcedure()
call a method that does not exist and check if the correct exception is thrown from the server.

throws
Exception

        Object result = null;
        try {
            Call call = getCall();
            call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS);
            result = call.invoke("unknownFreakyMethod", null);
        } catch (AxisFault fault){
            assertEquals(Constants.FAULT_SOAP12_SENDER, fault.getFaultCode());
            QName [] subCodes = fault.getFaultSubCodes();
            assertNotNull(subCodes);
            assertEquals(1, subCodes.length);
            assertEquals(Constants.FAULT_SUBCODE_PROC_NOT_PRESENT, subCodes[0]);
            return;
        }
        fail("Didn't catch expected fault");