FileDocCategorySizeDatePackage
TestSOAPFault.javaAPI DocApache Axis 1.42971Sat Apr 22 18:57:28 BST 2006test.message

TestSOAPFault

public class TestSOAPFault extends TestCase
author
steve.johnson@riskmetrics.com (Steve Johnson)
author
Davanum Srinivas (dims@yahoo.com)
version
$Revision: 257456 $

Fields Summary
String
xmlString
Constructors Summary
public TestSOAPFault(String name)
Constructor TestSOAPFault

param
name

        super(name);
    
Methods Summary
public static voidmain(java.lang.String[] argv)
Method main

param
argv

        TestSOAPFault tester = new TestSOAPFault("TestSOAPFault");
        tester.testSoapFaultBUG();
    
public static junit.framework.Testsuite()
Method suite

return

        return new TestSuite(TestSOAPFault.class);
    
public voidtestSoapFaultBUG()
Method testSoapFaultBUG

throws
Exception


               
         
        ByteArrayInputStream bis = new ByteArrayInputStream(xmlString.getBytes());
        MessageFactory msgFactory = MessageFactory.newInstance();
        SOAPMessage msg = msgFactory.createMessage(null, bis);
			
        //now attempt to access the fault
        if (msg.getSOAPPart().getEnvelope().getBody().hasFault()) {
            SOAPFault fault =
                    msg.getSOAPPart().getEnvelope().getBody().getFault();
            System.out.println("Fault: " + fault.getFaultString());
        }