Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPFaultText


                .createSOAPFaultValue(soapFaultCode);
        soapFaultValue.setText(new QName(
                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, "Sender"));

        SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason();
        SOAPFaultText soapFaultText = soapFactory
                .createSOAPFaultText(soapFaultReason);
        soapFaultText.setText(REASON);

        SOAPFaultDetail soapFaultDetail = soapFactory.createSOAPFaultDetail();
        QName qName = new QName("http://mycompany.com", "FaultException", "ex");
        OMElement exception = soapFactory.createOMElement(qName,
                soapFaultDetail);
View Full Code Here


                soapFactory = (SOAP12Factory)this.element.getOMFactory();
                if (this.fault.getReason() == null) {
                    SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason(this.fault);
                    this.fault.setReason(soapFaultReason);
                }
                SOAPFaultText soapFaultText =
                        soapFactory.createSOAPFaultText(this.fault.getReason());
                soapFaultText.setText(text);
                soapFaultText.setLang(locale.toString());
            } else {
                //update the text
                Iterator soapTextsItr = this.fault.getReason().getAllSoapTexts().iterator();
                while (soapTextsItr.hasNext()) {
                    SOAPFaultText soapFaultText = (SOAPFaultText)soapTextsItr.next();
                    if (soapFaultText.getLang().equals(locale.toString())) {
                        soapFaultText.setText(text);
                    }
                }

            }
View Full Code Here

            ArrayList faultReasonLocales = new ArrayList();
            List soapTextList = this.fault.getReason().getAllSoapTexts();
            if (soapTextList != null) {
                Iterator faultReasons = soapTextList.iterator();
                while (faultReasons.hasNext()) {
                    SOAPFaultText soapFaultText = (SOAPFaultText)faultReasons.next();
                    String lang = soapFaultText.getLang();
                    if (lang == null) {
                        faultReasonLocales.add(Locale.getDefault());
                    } else {
                        if (lang.indexOf("_") != -1) {
                            String language = lang.substring(0, lang.indexOf("_"));
View Full Code Here

            if (soapFaultReason != null) {
                List soapTexts = soapFaultReason.getAllSoapTexts();
                if (soapTexts != null) {
                    soapTextsItr = soapTexts.iterator();
                    while (soapTextsItr.hasNext()) {
                        SOAPFaultText soapFaultText = (SOAPFaultText)soapTextsItr.next();
                        if (soapFaultText.getLang().equals(locale.toString())) {
                            return soapFaultText.getText();
                        }
                    }
                }
            }
        }
View Full Code Here

        }

        Iterator soapTextsItr = this.fault.getReason().getAllSoapTexts().iterator();
        ArrayList reasonTexts = new ArrayList();
        while (soapTextsItr.hasNext()) {
            SOAPFaultText soapFaultText = (SOAPFaultText)soapTextsItr.next();
            reasonTexts.add(soapFaultText.getText());
        }
        return reasonTexts.iterator();
    }
View Full Code Here

        List soapTexts = null;
        if (isSoap11) {
            text = soapReason.getText();
        } else {
            soapTexts = soapReason.getAllSoapTexts();
            SOAPFaultText reasonText = (SOAPFaultText)soapTexts.get(0);
            text = reasonText.getText();
            lang = reasonText.getLang();
        }
        XMLFaultReason reason = new XMLFaultReason(text, lang);

        // Construct the XMLFault from the required information (code, reason, detail blocks)
        XMLFault xmlFault = new XMLFault(code, reason, detailBlocks);

        // Add the secondary fault information

        // Get the SubCodes
        SOAPFaultSubCode soapSubCode = soapCode.getSubCode();
        if (soapSubCode != null) {
            List<QName> list = new ArrayList<QName>();

            // Walk the nested sub codes and collect the qnames
            while (soapSubCode != null) {
                SOAPFaultValue soapSubCodeValue = soapSubCode.getValue();
                QName qName = soapSubCodeValue.getTextAsQName();
                list.add(qName);
                soapSubCode = soapSubCode.getSubCode();
            }

            // Put the collected sub code qnames onto the xmlFault
            QName[] qNames = new QName[list.size()];
            xmlFault.setSubCodes(list.toArray(qNames));
        }

        // Get the secondary Reasons...the first reason was already saved as the primary reason
        if (soapTexts != null && soapTexts.size() > 1) {
            XMLFaultReason[] secondaryReasons = new XMLFaultReason[soapTexts.size() - 1];
            for (int i = 1; i < soapTexts.size(); i++) {
                SOAPFaultText soapReasonText = (SOAPFaultText)soapTexts.get(i);
                secondaryReasons[i - 1] = new XMLFaultReason(soapReasonText.getText(),
                                                             soapReasonText.getLang());
            }
            xmlFault.setSecondaryReasons(secondaryReasons);
        }

        // Get the Node
View Full Code Here

        // Set the primary Reason Text
        SOAPFaultReason soapReason = factory.createSOAPFaultReason(soapFault);
        if (isSoap11) {
            soapReason.setText(xmlFault.getReason().getText());
        } else {
            SOAPFaultText soapText = factory.createSOAPFaultText(soapReason);
            soapText.setText(xmlFault.getReason().getText());
            soapText.setLang(xmlFault.getReason().getLang());
        }

        // Set the Detail and contents of Detail
        Block[] blocks = xmlFault.getDetailBlocks();
        if (blocks != null && blocks.length > 0) {
            SOAPFaultDetail detail = factory.createSOAPFaultDetail(soapFault);
            if (!ignoreDetailBlocks) {
                for (int i = 0; i < blocks.length; i++) {
                    // A Block implements OMDataSource.  So create OMSourcedElements
                    // for each of the Blocks.
                    OMSourcedElement element =
                            factory.createOMElement(blocks[i], blocks[i].getQName());
                    detail.addChild(element);
                }
            }
        }

        // Now set all of the secondary fault information
        // Set the SubCodes
        QName[] subCodes = xmlFault.getSubCodes();
        if (subCodes != null && subCodes.length > 0) {
            OMElement curr = soapCode;
            for (int i = 0; i < subCodes.length; i++) {
                SOAPFaultSubCode subCode = (i == 0) ?
                        factory.createSOAPFaultSubCode((SOAPFaultCode)curr) :
                        factory.createSOAPFaultSubCode((SOAPFaultSubCode)curr);
                SOAPFaultValue soapSubCodeValue = factory.createSOAPFaultValue(subCode);
                soapSubCodeValue.setText(subCodes[i]);
                curr = subCode;
            }
        }

        // Set the secondary reasons and languages
        XMLFaultReason reasons[] = xmlFault.getSecondaryReasons();
        if (reasons != null && reasons.length > 0) {
            for (int i = 0; i < reasons.length; i++) {
                SOAPFaultText soapReasonText = factory.createSOAPFaultText(soapReason);
                soapReasonText.setText(reasons[i].getText());
                soapReasonText.setLang(reasons[i].getLang());
            }
        }

        // Set the Role
        if (xmlFault.getRole() != null) {
View Full Code Here

                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));

            Iterator iteratorInReason = reason.getChildren();

            iteratorInReason.next();
            SOAPFaultText text = (SOAPFaultText) iteratorInReason.next();
            assertTrue("SOAP 1.2 :- Fault text local name mismatch",
                    text.getLocalName().equals(
                            SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME));
            assertTrue("SOAP 1.2 :- Text namespace uri mismatch",
                    text.getNamespace().getNamespaceURI().equals(
                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
            assertTrue("SOAP 1.2 :- Text value mismatch",
                    text.getText().equals("Sender Timeout"));

            iteratorInFault.next();
            SOAPFaultNode node = (SOAPFaultNode) iteratorInFault.next();
            assertTrue("SOAP 1.2 :- Fault node local name mismatch",
                    node.getLocalName().equals(
View Full Code Here

                faultcodePresent = true;
            } else if (SOAP_FAULT_STRING_LOCAL_NAME.equals(localName)) {

                SOAPFaultReason reason = factory.createSOAPFaultReason(
                        (SOAPFault) parent, builder);
                SOAPFaultText faultText = factory.createSOAPFaultText(reason);
                processNamespaceData(reason, false);
                processAttributes(reason);

                processText(parser, faultText);
                ((OMNodeEx)reason).setComplete(true);
View Full Code Here

            SOAPFaultReason reason = this.fault.getReason();
            if (reason.getFirstSOAPText() != null) {
                reason.getFirstSOAPText().getFirstOMChild().detach();
                reason.getFirstSOAPText().setText(faultString);
            } else {
                SOAPFaultText text = new SOAP11FaultTextImpl(reason,
                        (SOAPFactory) this.element.getOMFactory());
                text.setText(faultString);
                reason.addSOAPText(text);
            }
        } else {
            org.apache.axiom.soap.SOAPFactory soapFactory =
                    DOOMAbstractFactory.getSOAP11Factory();
            SOAPFaultReason fReason = soapFactory.createSOAPFaultReason(fault);
            SOAPFaultText fText = soapFactory.createSOAPFaultText(fReason);
            fText.setText(faultString);
        }
    }
View Full Code Here

TOP

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

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.