Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPFaultValue


          }
            if (context.isSOAP11()) {
              if(log.isDebugEnabled()){
                log.debug("context.isSOAP11() = true");
                SOAPFaultCode code = (fault!=null)?fault.getCode():null;
                SOAPFaultValue value = (code!=null)?code.getValue():null;
                if(value !=null){
                  QName name = value.getQName();
                  log.debug("prefix ="+name.getPrefix());
                  log.debug("Fault Code namespace ="+name.getNamespaceURI());
                  log.debug("Fault Code ="+name.getLocalPart());
                }
              }

                fault.getCode().setText(soapFaultCode);
            } else {
              if(log.isDebugEnabled()){
                log.debug("context.isSOAP11() = false");
                SOAPFaultCode code = (fault!=null)?fault.getCode():null;
                SOAPFaultValue value = (code!=null)?code.getValue():null;
                if(value !=null){
                  QName name = value.getQName();
                  log.debug("prefix ="+name.getPrefix());
                  log.debug("Fault Code namespace ="+name.getNamespaceURI());
                  log.debug("Fault Code ="+name.getLocalPart());
                }
              }
                SOAPFaultValue value = fault.getCode().getValue();
                if(log.isDebugEnabled()){
                    log.debug("soapFaultCode originally was set to : " + soapFaultCode);
                }
                OMNamespace namespace = value.getNamespace();
                soapFaultCode = switchNamespacePrefix(soapFaultCode, namespace);
                value.setText(soapFaultCode);
            }
        }
       
        if (axisFault != null && !context.isSOAP11()) {
            if (axisFault.getFaultSubCodes() != null) {
               
                List faultSubCodes = axisFault.getFaultSubCodes();
               
                QName faultSubCodeQName;

                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


        SOAPFactory soapFac = OMAbstractFactory.getSOAP12Factory();
        SOAPFaultCode soapFaultCode = soapFac.createSOAPFaultCode();
        if (messageContext.isSOAP11()) {
            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);
                if (namespace == null) {
                    namespace = Final.WSA_NAMESPACE;
                }
                OMNamespace wsaNS = soapFac.createOMNamespace(namespace,
                        AddressingConstants.WSA_DEFAULT_PREFIX);
                soapFaultSubcodeValue2.declareNamespace(wsaNS);
                soapFaultSubcodeValue2
                        .setText(AddressingConstants.WSA_DEFAULT_PREFIX + ":" + faultSubCode);
            }
        }
        messageContext.setProperty(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME, soapFaultCode);
    }
View Full Code Here

            SOAPFaultCode soapFaultCode = soapFac.createSOAPFaultCode();
            soapFaultCode.declareNamespace("http://someuri.org", "m");
            if (msgContext.isSOAP11()) {
                soapFaultCode.setText(M_FAULT_EXCEPTION);
            } else {
                SOAPFaultValue soapFaultValue = soapFac.createSOAPFaultValue(soapFaultCode);
                soapFaultValue.setText(M_FAULT_EXCEPTION);
            }

            SOAPFaultReason soapFaultReason = soapFac.createSOAPFaultReason();

            if (msgContext.isSOAP11()) {
View Full Code Here

        } else {
            soapFactory = OMAbstractFactory.getSOAP12Factory();
        }

        soapFaultCode = soapFactory.createSOAPFaultCode();
        SOAPFaultValue soapFaultValue = soapFactory.createSOAPFaultValue(soapFaultCode);
        soapFaultValue.setText(new QName("http://test.org", "TestFault", "test"));

        soapFaultReason = soapFactory.createSOAPFaultReason();
        SOAPFaultText soapFaultText = soapFactory.createSOAPFaultText(soapFaultReason);
        soapFaultText.setText("This is some FaultReason");
View Full Code Here

    public void testFaultSerialization() throws Exception {
        final String REASON = "ReasonValue";

        SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
        SOAPFaultCode soapFaultCode = soapFactory.createSOAPFaultCode();
        SOAPFaultValue soapFaultValue = soapFactory
                .createSOAPFaultValue(soapFaultCode);
        soapFaultValue.setText(new QName(
                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, "Sender"));

        SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason();
        SOAPFaultText soapFaultText = soapFactory
                .createSOAPFaultText(soapFaultReason);
View Full Code Here

            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

            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

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

        SOAPFaultCode soapCode = factory.createSOAPFaultCode(soapFault);
        QName soapValueQName = xmlFault.getCode().toQName(ns.getNamespaceURI());
        if (isSoap11) {
            soapCode.setText(soapValueQName);
        } else {
            SOAPFaultValue soapValue = factory.createSOAPFaultValue(soapCode);
            soapValue.setText(soapValueQName);
        }

        // 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
View Full Code Here

      }
    } else if (soapVersionURI.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
      // TODO AXIOM API returns only one fault sub code, there can be many
      SOAPFaultSubCode faultSubCode = faultCode.getSubCode();
      if (faultSubCode != null) {
        SOAPFaultValue faultSubCodeValue = faultSubCode.getValue();

        // This is a fault processing the security header
        if (faultSubCodeValue != null && faultSubCodeValue.getTextAsQName().
            getNamespaceURI().equals(WSConstants.WSSE_NS)) {
          return true;
        }
      }
    }
View Full Code Here

TOP

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

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.