Search in sources :

Example 26 with SOAPFault

use of org.apache.axiom.soap.SOAPFault in project webservices-axiom by apache.

the class TestAddSOAPText method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPFault fault = soapFactory.createSOAPFault();
    SOAPFaultReason faultReason = soapFactory.createSOAPFaultReason(fault);
    boolean gotFault = false;
    try {
        faultReason.addSOAPText(soapFactory.createSOAPFaultText(faultReason));
    } catch (UnsupportedOperationException e) {
        // Cool, continue.
        gotFault = true;
    }
    assertTrue("Didn't get expected Exception for addSOAPText()!", gotFault);
}
Also used : SOAPFaultReason(org.apache.axiom.soap.SOAPFaultReason) SOAPFault(org.apache.axiom.soap.SOAPFault)

Example 27 with SOAPFault

use of org.apache.axiom.soap.SOAPFault in project webservices-axiom by apache.

the class TestGetTextWithCDATA method runTest.

@Override
protected void runTest() throws Throwable {
    String soap11Fault = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" + "<SOAP-ENV:Body>" + "<SOAP-ENV:Fault>" + "<faultcode>SOAP-ENV:Server</faultcode>" + "<faultstring xml:lang=\"en\"><![CDATA[handleMessage throws SOAPFaultException for ThrowsSOAPFaultToClientHandlersTest]]></faultstring>" + "<detail>" + "<somefaultentry/>" + "</detail>" + "<faultactor>faultActor</faultactor>" + "</SOAP-ENV:Fault>" + "</SOAP-ENV:Body>" + "</SOAP-ENV:Envelope>";
    XMLStreamReader soap11Parser = StAXUtils.createXMLStreamReader(TEST_PARSER_CONFIGURATION, new StringReader(soap11Fault));
    SOAPModelBuilder soap11Builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(metaFactory, soap11Parser);
    OMElement element = soap11Builder.getDocumentElement();
    element.build();
    assertTrue(element instanceof SOAPEnvelope);
    SOAPEnvelope se = (SOAPEnvelope) element;
    SOAPFault fault = se.getBody().getFault();
    SOAPFaultReason reason = fault.getReason();
    assertTrue(reason.getText().equals("handleMessage throws SOAPFaultException for ThrowsSOAPFaultToClientHandlersTest"));
    soap11Parser.close();
}
Also used : XMLStreamReader(javax.xml.stream.XMLStreamReader) SOAPFaultReason(org.apache.axiom.soap.SOAPFaultReason) StringReader(java.io.StringReader) OMElement(org.apache.axiom.om.OMElement) SOAPFault(org.apache.axiom.soap.SOAPFault) SOAPModelBuilder(org.apache.axiom.soap.SOAPModelBuilder) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope)

Example 28 with SOAPFault

use of org.apache.axiom.soap.SOAPFault in project webservices-axiom by apache.

the class TestGetFirstSOAPText method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPFault fault = soapFactory.createSOAPFault();
    SOAPFaultReason faultReason = soapFactory.createSOAPFaultReason(fault);
    try {
        faultReason.getFirstSOAPText();
    } catch (UnsupportedOperationException e) {
        // Cool, continue.
        return;
    }
    fail("Didn't get expected Exception for getFirstSOAPText()!");
}
Also used : SOAPFaultReason(org.apache.axiom.soap.SOAPFaultReason) SOAPFault(org.apache.axiom.soap.SOAPFault)

Example 29 with SOAPFault

use of org.apache.axiom.soap.SOAPFault in project webservices-axiom by apache.

the class TestWrongParent2 method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPFault parent = soapFactory.createSOAPFault();
    OMElement child1 = soapFactory.createSOAPFaultCode(parent);
    SOAPHeaderBlock hb = soapFactory.createSOAPHeaderBlock("MyHeader", soapFactory.createOMNamespace("urn:test", "p"));
    try {
        child1.insertSiblingAfter(hb);
        fail("Expected SOAPProcessingException");
    } catch (SOAPProcessingException ex) {
    // Expected
    }
}
Also used : SOAPProcessingException(org.apache.axiom.soap.SOAPProcessingException) SOAPFault(org.apache.axiom.soap.SOAPFault) OMElement(org.apache.axiom.om.OMElement) SOAPHeaderBlock(org.apache.axiom.soap.SOAPHeaderBlock)

Example 30 with SOAPFault

use of org.apache.axiom.soap.SOAPFault in project webservices-axiom by apache.

the class TestSetNode method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPFault soapFault = soapFactory.createSOAPFault();
    try {
        soapFault.setNode(soapFactory.createSOAPFaultNode(soapFault));
    } catch (UnsupportedOperationException e) {
        // Exactly!
        return;
    }
    fail("Didn't get UnsupportedOperationException");
}
Also used : SOAPFault(org.apache.axiom.soap.SOAPFault)

Aggregations

SOAPFault (org.apache.axiom.soap.SOAPFault)35 SOAPEnvelope (org.apache.axiom.soap.SOAPEnvelope)13 OMElement (org.apache.axiom.om.OMElement)12 SOAPFaultReason (org.apache.axiom.soap.SOAPFaultReason)10 SOAPFaultDetail (org.apache.axiom.soap.SOAPFaultDetail)9 SOAPFaultCode (org.apache.axiom.soap.SOAPFaultCode)8 SOAPBody (org.apache.axiom.soap.SOAPBody)7 QName (javax.xml.namespace.QName)6 SOAPProcessingException (org.apache.axiom.soap.SOAPProcessingException)4 StringReader (java.io.StringReader)3 OMNamespace (org.apache.axiom.om.OMNamespace)3 OMNode (org.apache.axiom.om.OMNode)3 SOAPFaultRole (org.apache.axiom.soap.SOAPFaultRole)3 SOAPFaultSubCode (org.apache.axiom.soap.SOAPFaultSubCode)3 SOAPFaultValue (org.apache.axiom.soap.SOAPFaultValue)3 SOAPHeader (org.apache.axiom.soap.SOAPHeader)3 SOAPHeaderBlock (org.apache.axiom.soap.SOAPHeaderBlock)3 OMAttribute (org.apache.axiom.om.OMAttribute)2 OMXMLParserWrapper (org.apache.axiom.om.OMXMLParserWrapper)2 SOAPFaultNode (org.apache.axiom.soap.SOAPFaultNode)2