Examples of SoapFault


Examples of org.apache.axiom.soap.SOAPFault

    public TestGetCodeWithParser(OMMetaFactory metaFactory, SOAPSpec spec) {
        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPFault soapFaultWithParser = getTestMessage(MESSAGE).getBody().getFault();
        assertNotNull(
                "Fault Test with parser: - getCode method returns null",
                soapFaultWithParser.getCode());
        assertEquals(
                "Fault Test with parser: - Fault code local name mismatch",
                spec.getFaultCodeQName(), soapFaultWithParser.getCode().getQName());
    }
View Full Code Here

Examples of org.apache.axiom.soap.SOAPFault

    public TestGetException(OMMetaFactory metaFactory, SOAPSpec spec) {
        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPFault fault = soapFactory.createSOAPFault();
        SOAPFaultDetail detail = soapFactory.createSOAPFaultDetail(fault);
        OMElement detailEntry = soapFactory.createOMElement(new QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY));
        detailEntry.setText("This is an exception message");
        detail.addDetailEntry(detailEntry);
        Exception exception = fault.getException();
        assertNotNull(exception);
        assertEquals("This is an exception message", exception.getMessage());
    }
View Full Code Here

Examples of org.apache.axiom.soap.SOAPFault

    public TestGetDetail(OMMetaFactory metaFactory, SOAPSpec spec) {
        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPFault soapFault = soapFactory.createSOAPFault();
        assertNull(
                "Fault Test:- After creating a SOAPFault, it has a detail",
                soapFault.getDetail());
        soapFault.setDetail(soapFactory.createSOAPFaultDetail(soapFault));
        assertNotNull(
                "Fault Test:- After calling setDetail method, Fault has no detail",
                soapFault.getDetail());
        assertEquals("Fault Test:- Fault detail local name mismatch",
                spec.getFaultDetailQName(), soapFault.getDetail().getQName());
    }
View Full Code Here

Examples of org.apache.axiom.soap.SOAPFault

    public TestGetRole(OMMetaFactory metaFactory, SOAPSpec spec) {
        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPFault soapFault = soapFactory.createSOAPFault();
        assertNull(
                "Fault Test:- After creating a SOAPFault, it has a role",
                soapFault.getRole());
        soapFault.setRole(soapFactory.createSOAPFaultRole(soapFault));
        assertNotNull(
                "Fault Test:- After calling setRole method, Fault has no role",
                soapFault.getRole());
        assertEquals("Fault Test:- Fault role local name mismatch",
                spec.getFaultRoleQName(), soapFault.getRole().getQName());
    }
View Full Code Here

Examples of org.apache.axiom.soap.SOAPFault

    }

    protected void runTest() throws Throwable {
        OMElement parent = soapFactory.createOMElement("parent", null);
        OMElement child1 = soapFactory.createOMElement("child1", null, parent);
        SOAPFault fault = soapFactory.createSOAPFault();
        try {
            child1.insertSiblingAfter(fault);
            fail("Expected SOAPProcessingException");
        } catch (SOAPProcessingException ex) {
            // Expected
View Full Code Here

Examples of org.apache.axiom.soap.SOAPFault

    public TestSetDetail(OMMetaFactory metaFactory, SOAPSpec spec) {
        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPFault soapFault = soapFactory.createSOAPFault();
        soapFault.setDetail(soapFactory.createSOAPFaultDetail(soapFault));
        assertNotNull(
                "Fault Test:- After calling setDetail method, Fault has no detail",
                soapFault.getDetail());
        assertEquals("Fault Test:- Fault detail local name mismatch",
                spec.getFaultDetailQName(), soapFault.getDetail().getQName());
        try {
            soapFault.setDetail(altSoapFactory.createSOAPFaultDetail());
            fail("SOAPFaultDetail should not be set in to a SOAPFault for a different SOAP version");
        } catch (SOAPProcessingException e) {
            assertTrue(true);
        }
    }
View Full Code Here

Examples of org.apache.axiom.soap.SOAPFault

    public TestGetReasonWithParser(OMMetaFactory metaFactory, SOAPSpec spec) {
        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPFault soapFaultWithParser = getTestMessage(MESSAGE).getBody().getFault();
        assertNotNull(
                "Fault Test with parser: - getReason method returns null",
                soapFaultWithParser.getReason());
        assertEquals(
                "Fault Test with parser: - Fault reason local name mismatch",
                spec.getFaultReasonQName(), soapFaultWithParser.getReason().getQName());
    }
View Full Code Here

Examples of org.apache.axis.message.SOAPFault

            Message respMsg = serverContext.getResponseMessage();
            if (respMsg == null) {
                respMsg = new Message(fault);
                serverContext.setResponseMessage(respMsg);
            } else {
                SOAPFault faultEl = new SOAPFault(fault);
                SOAPEnvelope env = respMsg.getSOAPEnvelope();
                env.clearBody();
                env.addBodyElement(faultEl);
            }
        }
View Full Code Here

Examples of org.apache.axis2.soap.SOAPFault

                if (expectedEnvelope.getHeader() != null)
                    super.compare(ReplyEnvelope.getHeader(), expectedEnvelope.getHeader());

                if (expectedEnvelope.getBody().hasFault()) {
                    SOAPFault replyFault = ReplyEnvelope.getBody().getFault();
                    SOAPFault expectedFault = expectedEnvelope.getBody().getFault();

                    super.compare(replyFault.getCode(), expectedFault.getCode());
                    super.compare(replyFault.getReason(), expectedFault.getReason());

                    if (expectedFault.getRole() != null) {
                        super.compare(replyFault.getRole(), expectedFault.getRole());
                    }
                    if (expectedFault.getNode() != null) {
                        super.compare(replyFault.getNode(), expectedFault.getNode());
                    }
                    if (expectedFault.getDetail() != null) {
                        super.compare(replyFault.getDetail(), expectedFault.getDetail());
                    }
                } else {
                    super.compare(ReplyEnvelope.getBody(), expectedEnvelope.getBody());
                }
            } else {
View Full Code Here

Examples of org.apache.cxf.binding.soap.SoapFault

public class SoapFaultSerializerTest extends AbstractCXFTest {
   
    @Test
    public void testSoap11Out() throws Exception {
        String faultString = "Hadrian caused this Fault!";
        SoapFault fault = new SoapFault(faultString, Soap11.getInstance().getSender());

        SoapMessage m = new SoapMessage(new MessageImpl());
        m.setExchange(new ExchangeImpl());
        m.setContent(Exception.class, fault);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(out);
        writer.writeStartDocument();
        writer.writeStartElement("Body");

        m.setContent(XMLStreamWriter.class, writer);

        Soap11FaultOutInterceptorInternal.INSTANCE.handleMessage(m);

        writer.writeEndElement();
        writer.writeEndDocument();
        writer.close();

        Document faultDoc = StaxUtils.read(new ByteArrayInputStream(out.toByteArray()));
        assertValid("//s:Fault/faultcode[text()='ns1:Client']", faultDoc);
        assertValid("//s:Fault/faultstring[text()='" + faultString + "']", faultDoc);

        XMLStreamReader reader = StaxUtils.createXMLStreamReader(new ByteArrayInputStream(out.toByteArray()));
        m.setContent(XMLStreamReader.class, reader);

        reader.nextTag();

        Soap11FaultInInterceptor inInterceptor = new Soap11FaultInInterceptor();
        inInterceptor.handleMessage(m);

        SoapFault fault2 = (SoapFault)m.getContent(Exception.class);
        assertNotNull(fault2);
        assertEquals(fault.getMessage(), fault2.getMessage());
        assertEquals(Soap11.getInstance().getSender(), fault2.getFaultCode());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.