Search in sources :

Example 21 with SOAPFaultCode

use of org.apache.axiom.soap.SOAPFaultCode in project carbon-business-process by wso2.

the class SOAPUtils method createSoapFault.

/**
 * Crete SOAP Fault from fault information returned from ODE.
 *
 * @param bpelMessageContext DTO containing information on current messageflow.
 * @param odeMessageContext  ODE MyRoleMessageExchange containing information on current process
 *                           invocation.
 * @return SOAPFault instance
 * @throws AxisFault in case of a error while creating SOAP Fault.
 */
public static SOAPFault createSoapFault(final BPELMessageContext bpelMessageContext, final MessageExchange odeMessageContext) throws AxisFault {
    SOAPFactory soapFactory = bpelMessageContext.getSoapFactoryForCurrentMessageFlow();
    OMElement detail = buildSoapDetail(bpelMessageContext, odeMessageContext);
    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(odeMessageContext.getFault());
    SOAPFaultDetail soapDetail = soapFactory.createSOAPFaultDetail(fault);
    if (detail != null) {
        soapDetail.addDetailEntry(detail);
    }
    return fault;
}
Also used : SOAPFaultCode(org.apache.axiom.soap.SOAPFaultCode) QName(javax.xml.namespace.QName) SOAPFaultReason(org.apache.axiom.soap.SOAPFaultReason) SOAPFaultDetail(org.apache.axiom.soap.SOAPFaultDetail) OMElement(org.apache.axiom.om.OMElement) SOAPFault(org.apache.axiom.soap.SOAPFault) SOAPFactory(org.apache.axiom.soap.SOAPFactory)

Aggregations

SOAPFaultCode (org.apache.axiom.soap.SOAPFaultCode)21 SOAPFault (org.apache.axiom.soap.SOAPFault)12 QName (javax.xml.namespace.QName)10 SOAPEnvelope (org.apache.axiom.soap.SOAPEnvelope)10 SOAPFaultReason (org.apache.axiom.soap.SOAPFaultReason)8 OMElement (org.apache.axiom.om.OMElement)7 SOAPFaultDetail (org.apache.axiom.soap.SOAPFaultDetail)7 SOAPFaultValue (org.apache.axiom.soap.SOAPFaultValue)7 SOAPFactory (org.apache.axiom.soap.SOAPFactory)5 SOAPFaultRole (org.apache.axiom.soap.SOAPFaultRole)4 SOAPFaultText (org.apache.axiom.soap.SOAPFaultText)4 OMNamespace (org.apache.axiom.om.OMNamespace)3 OMNode (org.apache.axiom.om.OMNode)3 SOAPBody (org.apache.axiom.soap.SOAPBody)3 SOAPFaultNode (org.apache.axiom.soap.SOAPFaultNode)3 SOAPFaultSubCode (org.apache.axiom.soap.SOAPFaultSubCode)3 SOAPHeader (org.apache.axiom.soap.SOAPHeader)3 SOAPHeaderBlock (org.apache.axiom.soap.SOAPHeaderBlock)3 StringReader (java.io.StringReader)2 OMAttribute (org.apache.axiom.om.OMAttribute)2