Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPFault


        }
       
        // Check whether the message to be written is a fault message
        if (msgCtx.getFLOW() == MessageContext.OUT_FAULT_FLOW || msgCtx.getEnvelope().hasFault()) {
           
            SOAPFault soapFault = msgCtx.getEnvelope().getBody().getFault();
            convertAndWriteHessianFault(soapFault, out);
        } else {
           
            // no differentiation between normal reply and fault (pass the original message through)
            writeHessianMessage(msgCtx, out);
View Full Code Here


    public void addSoapFaultToMessageContext(MessageContext msgContext, String faultCode,
            String faultReason, String faultDetail) throws AxisFault {
       
        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope faultEnvelope = factory.getDefaultFaultEnvelope();      
        SOAPFault soapFault = faultEnvelope.getBody().getFault();

        SOAPFaultCode soapFaultCode = factory.createSOAPFaultCode();
        soapFaultCode.setText(faultCode);
        soapFault.setCode(soapFaultCode);
       
        SOAPFaultReason soapFaultReason = factory.createSOAPFaultReason();
        soapFaultReason.setText(faultReason);
        soapFault.setReason(soapFaultReason);
       
        SOAPFaultDetail soapFaultDetail = factory.createSOAPFaultDetail();
        soapFaultDetail.setText(faultDetail);
        soapFault.setDetail(soapFaultDetail);
       
        msgContext.setEnvelope(faultEnvelope);
    }
View Full Code Here

    private static final Log log = LogFactory.getLog(POXUtils.class);

    public static void convertSOAPFaultToPOX(MessageContext msgCtx) {

        SOAPBody body = msgCtx.getEnvelope().getBody();
        SOAPFault fault = body.getFault();
        if (fault != null) {

            OMFactory fac = msgCtx.getEnvelope().getOMFactory();
            OMElement faultPayload = fac.createOMElement(new QName("Exception"));

            if (fault.getDetail() != null && !fault.getDetail().getText().equals("")) {

                String faultDetail = fault.getDetail().getText();

                if (log.isDebugEnabled()) {
                    log.debug("Setting the fault detail : " + faultDetail + " as athe POX Fault");
                }
                faultPayload.setText(faultDetail);

            } else if (fault.getReason() != null && !fault.getReason().getText().equals("")) {

                String faultReasonValue = fault.getReason().getText();

                if (log.isDebugEnabled()) {
                    log.debug("Setting the fault reason : "
                        + faultReasonValue + " as athe POX Fault");
                }
View Full Code Here

        MessageContext synCtx = TestUtils.getAxis2MessageContext(
                "<empty/>", new HashMap<String, Entry>());
        faultMediator.mediate(synCtx);

        SOAPEnvelope envelope = synCtx.getEnvelope();
        SOAPFault fault = envelope.getBody().getFault();
        assertTrue(F_CODE.equals(fault.getCode().getTextAsQName()));
        assertTrue(F_STRING.equals(fault.getReason().getText()));
        assertTrue(F_ACTOR_URI.equals(fault.getRole().getRoleValue()));
        assertTrue(F_DETAIL.equals(fault.getDetail().getText()));
        assertEquals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, envelope.getNamespace().getNamespaceURI());
    }
View Full Code Here

        return env;
    }

    public SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException {
        SOAPEnvelope defaultEnvelope = getDefaultEnvelope();
        SOAPFault fault = createSOAPFault(defaultEnvelope.getBody());

        SOAPFaultCode faultCode = createSOAPFaultCode(fault);
        createSOAPFaultValue(faultCode);

        SOAPFaultReason reason = createSOAPFaultReason(fault);
View Full Code Here

        return env;
    }

    public SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException {
        SOAPEnvelope defaultEnvelope = getDefaultEnvelope();
        SOAPFault fault = createSOAPFault(defaultEnvelope.getBody());

        SOAPFaultCode faultCode = createSOAPFaultCode(fault);

        SOAPFaultReason reason = createSOAPFaultReason(fault);
        //createSOAPFaultText(reason);
View Full Code Here

        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPEnvelope env = soapFactory.getDefaultEnvelope();
        SOAPFault fault = soapFactory.createSOAPFault(env.getBody());
        SOAPFaultCode code = soapFactory.createSOAPFaultCode(fault);
        QName value = new QName("urn:test", "myFaultCode");
        code.setValue(value);
        assertEquals(value, code.getValueAsQName());
    }
View Full Code Here

    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

    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

    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

TOP

Related Classes of org.apache.axiom.soap.SOAPFault

Copyright © 2018 www.massapicom. 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.