Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPFaultCode


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

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

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


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

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

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

                    faultDetailString = element.getText();
                }
            }

            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();
View Full Code Here

                            } else {

                                try {
                                    SOAPFault fault = factory.createSOAPFault(body);
                                    SOAPFaultCode code = factory.createSOAPFaultCode(fault);
                                    SOAPFaultValue value = factory.createSOAPFaultValue(code);
                                    value.setText("env:MustUnderstand");
                                    SOAPFaultReason reason = factory.createSOAPFaultReason(fault);
                                    SOAPFaultText text = factory.createSOAPFaultText(reason);
                                    text.setLang("en-US");
View Full Code Here

        HttpServletResponse response =
                (HttpServletResponse) msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE);
        if (response != null) {

            //TODO : Check for SOAP 1.2!
            SOAPFaultCode code = faultContext.getEnvelope().getBody().getFault().getCode();

            OMElement valueElement = null;
            if (code != null) {
                valueElement = code.getFirstChildWithName(new QName(
                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
                        SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
            }

            if (valueElement != null) {
View Full Code Here

                            } else {

                                try {
                                    SOAPFault fault = factory.createSOAPFault(body);
                                    SOAPFaultCode code = factory.createSOAPFaultCode(fault);
                                    SOAPFaultValue value = factory.createSOAPFaultValue(code);
                                    value.setText("env:MustUnderstand");
                                    SOAPFaultReason reason = factory.createSOAPFaultReason(fault);
                                    SOAPFaultText text = factory.createSOAPFaultText(reason);
                                    text.setLang("en-US");
View Full Code Here

     *                       tree.
     * @see setFaultCode(Name), getFaultCode(),SOAPElement.addNamespaceDeclaration(String, String)
     */
    public void setFaultCode(String faultCode) throws SOAPException {
        org.apache.axiom.soap.SOAPFactory soapFactory = null;
        SOAPFaultCode soapFaultCode = null;

        //It must be of the form "prefix:localName" where the prefix has been defined in a
        //namespace declaration.
        if (faultCode.indexOf(":") == -1) {
            throw new SOAPException("faultCode must be of the form prefix:localName");
        }
//          else{
//              String prefix,localName ="";
//            prefix = faultCode.substring(0, faultCode.indexOf(":"));
//            localName = faultCode.substring(faultCode.indexOf(":")+1);
//          }

        if (this.element.getOMFactory() instanceof SOAP11Factory) {
            soapFactory = (SOAP11Factory)this.element.getOMFactory();
            soapFaultCode = soapFactory.createSOAPFaultCode(fault);
            soapFaultCode.setText(faultCode);
        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
            soapFactory = (SOAP12Factory)this.element.getOMFactory();
            soapFaultCode = soapFactory.createSOAPFaultCode(fault);
            SOAPFaultValue soapFaultValue = soapFactory.createSOAPFaultValue(soapFaultCode);
            soapFaultCode.setValue(soapFaultValue);
            soapFaultValue.setText(faultCode);
        }

        this.fault.setCode(soapFaultCode);
    }
View Full Code Here

    /**
     * Gets the fault code for this SOAPFault object as a <CODE>QName</CODE> object.
     * <p/>
     */
    public QName getFaultCodeAsQName() {
        SOAPFaultCode soapFaultCode = this.fault.getCode();
        if (soapFaultCode != null) {
            if (this.element.getOMFactory() instanceof SOAP11Factory) {
                return soapFaultCode.getTextAsQName();
            } else {
                return soapFaultCode.getValue().getTextAsQName();
            }
        }
        return null;
    }
View Full Code Here

            }
            soapFactory = (SOAPFactory)this.element.getOMFactory();
        } else {
            throw new SOAPException("Invalid SOAP version");
        }
        SOAPFaultCode soapFaultCode = soapFactory.createSOAPFaultCode(this.fault);

        String prefix = ((qname.getPrefix() != null) && !qname.getPrefix()
                .equals("")) ? qname.getPrefix() : this.fault.getQName()
                .getPrefix();

        if (this.element.getOMFactory() instanceof SOAP11Factory) {
            soapFaultCode.setText(prefix + ":" + qname.getLocalPart());
            OMNamespace omNamespace = new OMNamespaceImpl(qname.getNamespaceURI(),
                                                          qname.getPrefix());
            soapFaultCode.declareNamespace(omNamespace);
        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
            SOAPFaultValue soapFaultValue = soapFactory.createSOAPFaultValue(soapFaultCode);
            // don't just use the default prefix, use the passed one or the parent's
            soapFaultValue.setText(prefix + ":" + qname.getLocalPart());
            OMNamespace omNamespace = new OMNamespaceImpl(qname.getNamespaceURI(),
                                                          qname.getPrefix());
            soapFaultValue.declareNamespace(omNamespace);
            soapFaultCode.setValue(soapFaultValue);
        }
       
        this.fault.setCode(soapFaultCode);
    }
View Full Code Here

        //figureout the soap version
        boolean isSoap11 = soapFault.getNamespace().getNamespaceURI().equals(
                SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);

        SOAPFaultCode soapCode = soapFault.getCode();
        QName codeQName = null;
        if (isSoap11) {
            codeQName = soapCode.getTextAsQName();
        } else {
            codeQName = soapCode.getValue().getTextAsQName();
        }
        XMLFaultCode code = XMLFaultCode.fromQName(codeQName);

        // Get the primary reason text
        // TODO what if this fails
        SOAPFaultReason soapReason = soapFault.getReason();
        String text = null;
        String lang = null;
        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) {
View Full Code Here

TOP

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

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.