public String getFaultString() { if (this.omTarget.getNamespace().getNamespaceURI().equals( SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) { return this.omTarget.getReason().getText(); } else { if (this.omTarget.getReason() != null && this.omTarget.getReason().getFirstSOAPText() != null) { return this.omTarget.getReason().getFirstSOAPText().getText(); } } return null; }
private void setFaultNode(SOAPFactory factory, SOAPFault fault) { if (faultNode != null) { SOAPFaultNode soapfaultNode = factory.createSOAPFaultNode(); soapfaultNode.setFaultNodeValue(faultNode.toString()); fault.setNode(soapfaultNode); } }
/** * Sets this SOAPFault object with the given fault actor.The fault actor is the recipient in the * message path who caused the fault to happen. If this SOAPFault supports SOAP 1.2 then this * call is equivalent to setFaultRole(String) * * @param faultActor - a String identifying the actor that caused this SOAPFault object * @throws SOAPException - if there was an error in adding the faultActor to the underlying XML * tree. */ public void setFaultActor(String faultActor) throws SOAPException { if (this.omTarget.getRole() == null) { SOAPFaultRole faultRoleImpl = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPFaultRole( this.omTarget); faultRoleImpl.setRoleValue(faultActor); this.omTarget.setRole(faultRoleImpl); } else { SOAPFaultRole role = this.omTarget.getRole(); role.setRoleValue(faultActor); } }
fault.setCode((SOAPFaultCode) faultCode); soapFaultCode = ((SOAPFaultCode) faultCode).getText(); } else if (soapException != null) { fault.setCode(axisFault.getFaultCodeElement()); soapFaultCode = axisFault.getFaultCodeElement().getText(); } else { fault.getNamespace().getNamespaceURI() : uri; prefix = fault.declareNamespace(uri, prefix.length() == 0 ? null : prefix).getPrefix(); soapFaultCode = prefix + ":" + faultCodeQName.getLocalPart(); if(log.isDebugEnabled()){ 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){ 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){ SOAPFaultValue value = fault.getCode().getValue();
final int SOAP_12 = 2; if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI .equals(fault.getNamespace().getNamespaceURI())) { fac = OMAbstractFactory.getSOAP11Factory(); soapVersion = SOAP_11; code.setText(fault.getCode().getTextAsQName()); reason.setText(fault.getReason().getText()); break; case SOAP_12: SOAPFaultValue value = fac.createSOAPFaultValue(code); value.setText(fault.getCode().getTextAsQName()); for (Object obj : fault.getReason().getAllSoapTexts()) { SOAPFaultText text = fac.createSOAPFaultText(); text.setText(((SOAPFaultText) obj).getText()); newFault.setCode(code); newFault.setReason(reason); if (fault.getNode() != null) { SOAPFaultNode soapfaultNode = fac.createSOAPFaultNode(); soapfaultNode.setNodeValue(fault.getNode().getNodeValue()); newFault.setNode(soapfaultNode); if (fault.getRole() != null) { SOAPFaultRole soapFaultRole = fac.createSOAPFaultRole(); soapFaultRole.setRoleValue(fault.getRole().getRoleValue()); newFault.setRole(soapFaultRole);
SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason(); soapFaultReason.setText(reason); message.getBody().getFault().setReason(soapFaultReason); SOAPFaultCode soapFaultCode = soapFactory.createSOAPFaultCode(); QName qNameSubCode = new QName("http://wso2.org/passivests", subCode, "sts"); soapFaultCode.setText(qNameSubCode); message.getBody().getFault().setCode(soapFaultCode); return message.getBody().getFault(); } else { SOAPFaultDetail soapFaultDetail = soapFactory.createSOAPFaultDetail(); soapFaultDetail.setText(detail); message.getBody().getFault().setDetail(soapFaultDetail); SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason(); SOAPFaultText soapFaultText = soapFactory.createSOAPFaultText(); soapFaultText.setText(reason); soapFaultReason.addSOAPText(soapFaultText); message.getBody().getFault().setReason(soapFaultReason); SOAPFaultCode soapFaultCode = soapFactory.createSOAPFaultCode(); SOAPFaultValue soapFaultValue = soapFactory.createSOAPFaultValue(soapFaultCode); soapFaultSubCode.setValue(soapFaultValueSub); soapFaultCode.setSubCode(soapFaultSubCode); message.getBody().getFault().setCode(soapFaultCode); return message.getBody().getFault();
newEnvelope.getBody().addChild(newSOAPFault); SOAPFaultCode code = soapFault.getCode(); if(code != null) { SOAPFaultCode newSOAPFaultCode = soap12Factory.createSOAPFaultCode(); newSOAPFault.setCode(newSOAPFaultCode); SOAPFaultReason reason = soapFault.getReason(); if(reason != null) { SOAPFaultReason newSOAPFaultReason newSOAPFaultText.setText(reasonText); newSOAPFault.setReason(newSOAPFaultReason); SOAPFaultDetail detail = soapFault.getDetail(); if(detail != null) { SOAPFaultDetail newSOAPFaultDetail newSOAPFaultDetail.addDetailEntry(detailEntry); newSOAPFault.setDetail(newSOAPFaultDetail);
faultCode.setText(new QName(fault.getNamespace().getNamespaceURI(), code)); } else { SOAPFaultValue value = factory.createSOAPFaultValue(faultCode); value.setText(new QName(fault.getNamespace().getNamespaceURI(), code)); fault.setCode(faultCode); faultReason.addSOAPText(text); fault.setReason(faultReason); fault.setDetail(soapFaultDetail);
/** * Gets the fault code for this SOAPFault object as a <CODE>QName</CODE> object. * <p/> */ public QName getFaultCodeAsQName() { SOAPFaultCode soapFaultCode = this.omTarget.getCode(); return soapFaultCode != null ? soapFaultCode.getValueAsQName() : null; }
soapFaultCode.setText(soapFactory.getSOAPVersion().getReceiverFaultCode()); soapFault.setCode(soapFaultCode); soapFault.setReason(soapFaultReason); soapFault.setRole(soapFaultRole); soapFault.setDetail(soapFaultDetail); soapFault.setDetail(soapFaultDetail); soapFaultReason.setText(JBI_FAULT_STRING);
/** Returns true if this SOAPFault has a Detail subelement and false otherwise. */ public boolean hasDetail() { if (this.omTarget.getDetail() != null) { return true; } else { return false; } }
void removeDefaults() { if (defaultsSet) { SOAPFaultReason reason = this.omTarget.getReason(); if (reason != null) { reason.detach(); } defaultsSet = false; } }
throw new SOAPException("Received null for locale"); if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) { throw new UnsupportedOperationException("Not supported in SOAP 1.1"); } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP12) { removeDefaults(); if (existingReasonText == null) { org.apache.axiom.soap.SOAPFactory soapFactory = null; soapFactory = (SOAPFactory)this.omTarget.getOMFactory(); if (this.omTarget.getReason() == null) { SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason(this.omTarget); this.omTarget.setReason(soapFaultReason); soapFactory.createSOAPFaultText(this.omTarget.getReason()); soapFaultText.setText(text); soapFaultText.setLang(locale.toString()); } else { Iterator soapTextsItr = this.omTarget.getReason().getAllSoapTexts().iterator(); while (soapTextsItr.hasNext()) { SOAPFaultText soapFaultText = (SOAPFaultText)soapTextsItr.next();
SOAPFaultDetail soapFaultDetail = factory.createSOAPFaultDetail(); soapFaultDetail.setText(faultDetail); fault.setDetail(soapFaultDetail); } else if (faultDetailExpr != null) { SOAPFaultDetail soapFaultDetail = factory.createSOAPFaultDetail(); soapFaultDetail.setText(faultDetailExpr.stringValueOf(synCtx)); fault.setDetail(soapFaultDetail); } else if (!faultDetailElements.isEmpty()) { SOAPFaultDetail soapFaultDetail = factory.createSOAPFaultDetail(); soapFaultDetail.addChild(faultDetailElement.cloneOMElement()); fault.setDetail(soapFaultDetail); } else if (fault.getDetail() != null) { fault.getDetail().detach();
private void setFaultCode(MessageContext synCtx, SOAPFactory factory, SOAPFault fault, int soapVersion) { QName fault_code = null; if (faultCodeValue == null && faultCodeExpr == null) { handleException("A valid fault code QName value or expression is required", synCtx); } else if (faultCodeValue != null) { fault_code = faultCodeValue; } else { String codeStr = faultCodeExpr.stringValueOf(synCtx); fault_code = new QName(fault.getNamespace().getNamespaceURI(),codeStr); } SOAPFaultCode code = factory.createSOAPFaultCode(); switch (soapVersion) { case SOAP11: code.setText(fault_code); break; case SOAP12: SOAPFaultValue value = factory.createSOAPFaultValue(code); value.setText(fault_code); break; } fault.setCode(code); }
/** * Removes any Subcodes that may be contained by this SOAPFault. Subsequent calls to * getFaultSubcodes will return an empty iterator until a call to appendFaultSubcode is made. * * @throws UnsupportedOperationException * - if this message does not support the SOAP 1.2 concept of Subcode. */ public void removeAllFaultSubcodes() { if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) { throw new UnsupportedOperationException(); } else { omTarget.getCode().getSubCode().detach(); } }
private SOAPFault addStandardFault(String localName, String faultString, Locale locale) { Assert.notNull(faultString, "No faultString given"); try { AxiomUtils.removeContents(getAxiomBody()); SOAPFault fault = getAxiomFactory().createSOAPFault(getAxiomBody()); SOAPFaultCode faultCode = getAxiomFactory().createSOAPFaultCode(fault); faultCode.setText(new QName(fault.getNamespace().getNamespaceURI(), localName, fault.getNamespace().getPrefix())); SOAPFaultReason faultReason = getAxiomFactory().createSOAPFaultReason(fault); if (locale != null) { addLangAttribute(locale, faultReason); } faultReason.setText(faultString); return fault; } catch (SOAPProcessingException ex) { throw new AxiomSoapFaultException(ex); } }
if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) { soapFactory = (SOAPFactory)this.omTarget.getOMFactory(); } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP12) { if (!(qname.getNamespaceURI() .equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE))) { + qname.getNamespaceURI()); soapFactory = (SOAPFactory)this.omTarget.getOMFactory(); } else { throw new SOAPException("Invalid SOAP version"); .equals("")) ? qname.getPrefix() : this.omTarget.getQName() .getPrefix(); OMFactory factory = omTarget.getOMFactory(); if (((SOAPFactory)factory).getSOAPVersion() == SOAPVersion.SOAP11) { soapFaultCode.setText(prefix + ":" + qname.getLocalPart()); this.omTarget.setCode(soapFaultCode);