Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPFault


      throw new SandeshaException("SOAP Envelope is null");

    SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil
        .getSOAPVersion(faultMsgEnvelope));

    SOAPFault fault = faultMsgEnvelope.getBody().getFault();
    SOAPFaultCode faultCode = fault.getCode();

    if (isSequenceFault(data)) {
      faultCode.setText(data.getCode());
    } else {
      faultCode.setText(data.getSubcode());
    }

    SOAPFaultReason faultReason = fault.getReason();

    OMNamespace namespace = factory.createOMNamespace(
        OMConstants.XMLNS_URI, OMConstants.XMLNS_PREFIX);
    faultReason.getSOAPFaultText("en").addAttribute("lang", "en", namespace);
View Full Code Here


      throw new SandeshaException("SOAP Envelope is null");

    SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil
        .getSOAPVersion(faultEnvelope));

    SOAPFault fault = faultEnvelope.getBody().getFault();
    if (fault == null)
      throw new SandeshaException("Fault part is null");

    SOAPFaultCode faultCode = fault.getCode();
    SOAPFaultValue codeValue = faultCode.getValue();
    codeValue.setText(data.getCode());

    SOAPFaultSubCode faultSubCode = factory
        .createSOAPFaultSubCode(faultCode);
    SOAPFaultValue subCodeValue = factory
        .createSOAPFaultValue(faultSubCode);
    subCodeValue.setText(data.getSubcode());

    SOAPFaultReason faultReason = fault.getReason();
    SOAPFaultText faultText = faultReason.getSOAPFaultText("en");
   
    if (faultText==null) {
      faultText = factory.createSOAPFaultText();
    }
   
    if (data!=null && data.getReason()!=null)
      faultText.setText(data.getReason());

    SOAPFaultDetail faultDetail = fault.getDetail();

    OMElement detailElement = data.getDetail();

    if (detailElement != null)
      faultDetail.addChild(detailElement);
View Full Code Here

          SandeshaMessageKeys.soapEnvNotSet));

    SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil
        .getSOAPVersion(faultMsgEnvelope));

    SOAPFault fault = faultMsgEnvelope.getBody().getFault();

        SOAPFaultCode code = fault.getCode();
        if (data.getCode()!=null) {
            code.setText(data.getCode());
        }

        if (data.getExceptionString() != null)
      fault.getDetail().setText(data.getExceptionString());
   
    //SequenceFault header is added only for SOAP 1.1
    if (isSequenceFault(data))
      addSequenceFaultHeader(faultMsgContext, data, factory, rmNamespaceValue);
View Full Code Here

          SandeshaMessageKeys.soapEnvNotSet));

    SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil
        .getSOAPVersion(faultEnvelope));

    SOAPFault fault = faultEnvelope.getBody().getFault();
    if (fault == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.noFaultCode,
          faultEnvelope.toString()));

    SOAPFaultCode faultCode = fault.getCode();
    SOAPFaultValue codeValue = faultCode.getValue();
    codeValue.setText(data.getCode());

    SOAPFaultSubCode faultSubCode = factory
        .createSOAPFaultSubCode(faultCode);
    SOAPFaultValue subCodeValue = factory
        .createSOAPFaultValue(faultSubCode);
    subCodeValue.setText(data.getSubcode());

    SOAPFaultReason faultReason = fault.getReason();
    SOAPFaultText faultText = faultReason.getSOAPFaultText("en");
   
    if (faultText==null) {
      faultText = factory.createSOAPFaultText();
      faultReason.addSOAPText(faultText);
    }
   
    if (data.getReason()!=null)
      faultText.setText(data.getReason());

    SOAPFaultDetail faultDetail = fault.getDetail();

    OMElement detailElement = data.getDetail();

    if (detailElement != null)
      faultDetail.addChild(detailElement);
View Full Code Here

        // invoke transformation, with static enveope
        MessageContext synCtx = TestUtils.getTestContext("<empty/>");
        faultMediator.mediate(synCtx);

        SOAPEnvelope envelope = synCtx.getEnvelope();
        SOAPFault fault = envelope.getBody().getFault();
        assertTrue(F_CODE.equals(fault.getCode().getValue().getTextAsQName()));
        assertTrue(F_STRING.equals(fault.getReason().getFirstSOAPText().getText()));
        assertTrue(F_ACTOR_URI.equals(fault.getRole().getRoleValue()));
        assertTrue(F_DETAIL.equals(fault.getDetail().getText()));
    }
View Full Code Here

        return "";
    }
   
    public QName parseSoapFault(Element odeMsgEl, SOAPEnvelope envelope, Operation operation) throws AxisFault {
        SOAPFault flt = envelope.getBody().getFault();
        SOAPFaultDetail detail = flt.getDetail();
        Fault fdef = inferFault(operation, flt);
        if (fdef == null)
            return null;

        Part pdef = (Part)fdef.getMessage().getParts().values().iterator().next();
View Full Code Here

            }
            AxisEngine.send(outMsgContext);
    }

        private SOAPFault toSoapFault(Exception e, SOAPFactory soapFactory) {
        SOAPFault fault = soapFactory.createSOAPFault();
        SOAPFaultCode code = soapFactory.createSOAPFaultCode(fault);
        code.setText(new QName(Namespaces.SOAP_ENV_NS, "Server"));
        SOAPFaultReason reason = soapFactory.createSOAPFaultReason(fault);
        reason.setText(e.toString());
View Full Code Here

    }

    public SOAPFault createSoapFault(Element message, QName faultName, Operation op) throws AxisFault {
        OMElement detail = buildSoapDetail(message, faultName, op);

        SOAPFault fault = _soapFactory.createSOAPFault();
        SOAPFaultCode code = _soapFactory.createSOAPFaultCode(fault);
        code.setText(new QName(Namespaces.SOAP_ENV_NS, "Server"));
        SOAPFaultReason reason = _soapFactory.createSOAPFaultReason(fault);
        reason.setText(faultName);
        SOAPFaultDetail soapDetail = _soapFactory.createSOAPFaultDetail(fault);
View Full Code Here

        return "";
    }
   
    public QName parseSoapFault(Element odeMsgEl, SOAPEnvelope envelope, Operation operation) throws AxisFault {
        SOAPFault flt = envelope.getBody().getFault();
        SOAPFaultDetail detail = flt.getDetail();
        Fault fdef = inferFault(operation, flt);
        if (fdef == null)
            return null;

        Part pdef = (Part)fdef.getMessage().getParts().values().iterator().next();
View Full Code Here

            MessageContext faultContext = MessageContextBuilder.createFaultMessageContext(msgContext, e);
            //Per SOAP 1.1 Fault description, if it is not allowed to use detail elements for carrying information about error information belonging to header entries.
            if (SOAP_1_1_FAULT_DETAIL_COMPATIBLE_WHEN_ADDRESSING_FAULTS && faultContext.isSOAP11()) {
                Map faultInfo = (Map) faultContext.getLocalProperty(Constants.FAULT_INFORMATION_FOR_HEADERS);
                if (faultInfo != null) {
                    SOAPFault soapFault = faultContext.getEnvelope().getBody().getFault();
                    if (soapFault != null && soapFault.getDetail() != null) {
                        soapFault.getDetail().detach();
                    }
                }
            }
            AxisEngine.sendFault(faultContext);
        } catch (Exception ex) {
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.