Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPFaultSubCode


    public TestGetValueAsQNameWithParser(OMMetaFactory metaFactory) {
        super(metaFactory, SOAPSpec.SOAP12);
    }

    protected void runTest() throws Throwable {
        SOAPFaultSubCode subCode = getTestMessage(MESSAGE).getBody().getFault().getCode().getSubCode();
        assertEquals(new QName("http:www.sample.org", "MessageTimeout_In_First_Subcode"), subCode.getValueAsQName());
    }
View Full Code Here


                   valueQName.getNamespaceURI().equals(
                           SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));


        iteratorInCode.next();
        SOAPFaultSubCode subCode1 = (SOAPFaultSubCode) iteratorInCode.next();
        assertTrue("SOAP 1.2 :- Fault sub code local name mismatch",
                   subCode1.getLocalName().equals(
                           SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));
        assertTrue("SOAP 1.2 :- Fault subcode namespace uri mismatch",
                   subCode1.getNamespace().getNamespaceURI().equals(
                           SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));

        Iterator iteratorInSubCode1 = subCode1.getChildren();

        iteratorInSubCode1.next();
        SOAPFaultValue value2 = (SOAPFaultValue) iteratorInSubCode1.next();
        assertTrue("SOAP 1.2 :- Fault code value local name mismatch",
                   value2.getLocalName().equals(
                           SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
        assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch",
                   value2.getNamespace().getNamespaceURI().equals(
                           SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
        assertTrue("SOAP 1.2 :- Value2 text mismatch",
                   value2.getText().equals("m:MessageTimeout"));

        iteratorInSubCode1.next();
        SOAPFaultSubCode subCode2 = (SOAPFaultSubCode) iteratorInSubCode1.next();
        assertTrue("SOAP 1.2 :- Fault sub code local name mismatch",
                   subCode2.getLocalName().equals(
                           SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));
        assertTrue("SOAP 1.2 :- Fault subcode namespace uri mismatch",
                   subCode2.getNamespace().getNamespaceURI().equals(
                           SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));

        Iterator iteratorInSubCode2 = subCode2.getChildren();

        iteratorInSubCode2.next();
        SOAPFaultValue value3 = (SOAPFaultValue) iteratorInSubCode2.next();
        assertTrue("SOAP 1.2 :- Fault code value local name mismatch",
                   value3.getLocalName().equals(
View Full Code Here

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = soapFactory.getDefaultFaultEnvelope();
        SOAPFault fault = envelope.getBody().getFault();
        SOAPFaultCode code = fault.getCode();
        SOAPFaultSubCode subCode = soapFactory.createSOAPFaultSubCode(code);
        assertEquals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, subCode.getNamespaceURI());
        assertEquals(SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, subCode.getLocalName());
        assertSame(code, subCode.getParent());
        Iterator it = code.getChildren();
        assertTrue(it.hasNext());
        assertTrue(it.next() instanceof SOAPFaultValue);
        assertTrue(it.hasNext());
        assertSame(subCode, it.next());
View Full Code Here

                for (Object faultSubCode : faultSubCodes) {

                    faultSubCodeQName = (QName)faultSubCode;

                    SOAPFactory sf = (SOAPFactory)envelope.getOMFactory();
                    SOAPFaultSubCode soapFaultSubCode = sf.createSOAPFaultSubCode(fault.getCode());
                    SOAPFaultValue saopFaultValue = sf.createSOAPFaultValue(fault.getCode());
                    saopFaultValue.setText(faultSubCodeQName);
                    soapFaultSubCode.setValue(saopFaultValue);
                    fault.getCode().setSubCode(soapFaultSubCode);
                }
               
            }
        }
View Full Code Here

            soapFaultCode.setText(faultCode);
        } else {
            SOAPFaultValue soapFaultValue = soapFac.createSOAPFaultValue(soapFaultCode);
            soapFaultValue.setText(SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX + ":" +
                    SOAP12Constants.FAULT_CODE_SENDER);
            SOAPFaultSubCode soapFaultSubCode = soapFac.createSOAPFaultSubCode(soapFaultCode);
            SOAPFaultValue soapFaultSubcodeValue = soapFac.createSOAPFaultValue(soapFaultSubCode);

            if (faultCode != null){
                String namespace =
                        (String) messageContext.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if (namespace == null) {
                    namespace = Final.WSA_NAMESPACE;
                }
                OMNamespace wsaNS = soapFac.createOMNamespace(namespace,
                        AddressingConstants.WSA_DEFAULT_PREFIX);
                soapFaultSubcodeValue.declareNamespace(wsaNS);
                soapFaultSubcodeValue
                        .setText(AddressingConstants.WSA_DEFAULT_PREFIX + ":" + faultCode);
            }

            if (faultSubCode != null) {
                SOAPFaultSubCode soapFaultSubCode2 =
                        soapFac.createSOAPFaultSubCode(soapFaultSubCode);
                SOAPFaultValue soapFaultSubcodeValue2 =
                        soapFac.createSOAPFaultValue(soapFaultSubCode2);
                String namespace =
                        (String) messageContext.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
View Full Code Here

        if (soapFaultCode != null) {
            // This works the same regardless of SOAP version
            faultCode = soapFaultCode.getTextAsQName();

            SOAPFaultSubCode subCode = soapFaultCode.getSubCode();
            if (subCode != null) {
                faultSubCodes = new ArrayList();
                while (subCode != null) {
                    faultSubCodes.add(subCode.getValue().getTextAsQName());
                    subCode = subCode.getSubCode();
                }
            }
        }
    }
View Full Code Here

                }
            }

            String faultLocalName;
            SOAPFaultCode code = fault.getCode();
            SOAPFaultSubCode subCode = code.getSubCode();
            if (subCode == null) {
                faultLocalName = code.getTextAsQName().getLocalPart();
            } else {
                while (subCode.getSubCode() != null) {
                    subCode = subCode.getSubCode();
                }
                faultLocalName = subCode.getValue().getTextAsQName().getLocalPart();
            }

            String newReason = AddressingFaultsHelper
                    .getMessageForAxisFault(faultLocalName, faultDetailString);
View Full Code Here

     *                       - if this message does not support the SOAP 1.2 concept of Subcode.
     */

    public void appendFaultSubcode(QName subcode) throws SOAPException {
        org.apache.axiom.soap.SOAPFactory soapFactory = null;
        SOAPFaultSubCode soapFaultSubCode = null;

        if (subcode.getNamespaceURI() == null || subcode.getNamespaceURI().trim().length() == 0) {
            throw new SOAPException("Unqualified QName object : " + subcode);
        }
        if (this.element.getOMFactory() instanceof SOAP11Factory) {
View Full Code Here

            soapFaultValueimpl.declareNamespace(subcode.getNamespaceURI(), subcode.getPrefix());
        }
    }

    private SOAPFaultSubCode getLastSubCode(SOAPFaultSubCode firstSubCodeElement) {
        SOAPFaultSubCode soapFaultSubCode = firstSubCodeElement.getSubCode();
        if (soapFaultSubCode != null) {
            return getLastSubCode(soapFaultSubCode);
        }
        return firstSubCodeElement;
    }
View Full Code Here

    public Iterator getFaultSubcodes() {
        if (this.element.getOMFactory() instanceof SOAP11Factory) {
            throw new UnsupportedOperationException();
        }
        ArrayList faultSubcodes = new ArrayList();
        SOAPFaultSubCode subCodeElement = this.fault.getCode().getSubCode();
        while (subCodeElement != null) {
            QName qname = subCodeElement.getValue().getTextAsQName();
            faultSubcodes.add(qname);
            subCodeElement = subCodeElement.getSubCode();
        }
        return faultSubcodes.iterator();
    }
View Full Code Here

TOP

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

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.