/** * Select the Action URI value to return for the given {@link Fault}. * * @param fault the fault * @return the selected Action URI */ @Nonnull protected String selectActionURIForFault(@Nonnull final Fault fault) { QName faultCode = null; if (fault.getCode() != null && fault.getCode().getValue() != null) { faultCode = fault.getCode().getValue(); } if (faultCode != null && WSAddressingConstants.WS_ADDRESSING_FAULTS.contains(faultCode)) { return WSAddressingConstants.ACTION_URI_FAULT; } else { return WSAddressingConstants.ACTION_URI_SOAP_FAULT; } }
private String[] getPrincipalIdFromSamlEcpFault(final Fault fault) { val result = new ToStringBuilder(this, ToStringStyle.NO_CLASS_NAME_STYLE) .append("actor", fault.getActor().getValue()) .append("message", fault.getMessage().getValue()) .toString(); return new String[]{result}; } }
/** {@inheritDoc} */ protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject) throws UnmarshallingException { Fault fault = (Fault) parentXMLObject; if(childXMLObject instanceof XSQName){ fault.setCode((FaultCode) childXMLObject); }else if(childXMLObject instanceof XSString){ fault.setMessage((FaultString) childXMLObject); }else if(childXMLObject instanceof XSURI){ fault.setActor((FaultActor) childXMLObject); }else if(childXMLObject instanceof Detail){ fault.setDetail((Detail) childXMLObject); } }
fault.setCode(faultCode); fault.setActor(faultActor); fault.setMessage(faultString);
if (fault.getCode() != null) { code = fault.getCode().getValue(); if (fault.getMessage() != null) { msg = fault.getMessage().getValue();
/** * Build and attach {@link FaultString} element. * * @param fault the element to attach to * @param message the message to set */ private void buildFaultString(@Nonnull final Fault fault, @Nonnull @NotEmpty final String message) { final XMLObjectBuilder<FaultString> faultStringBuilder = XMLObjectProviderRegistrySupport.getBuilderFactory().<FaultString>getBuilderOrThrow( FaultString.DEFAULT_ELEMENT_NAME); final FaultString fs = faultStringBuilder.buildObject(FaultString.DEFAULT_ELEMENT_NAME); fs.setValue(message); fault.setMessage(fs); }
code.setValue(defaultFaultCode); fault.setCode(code);
String msg = "(not set)"; final Fault fault = (Fault) faults.get(0); if (fault.getCode() != null) { code = fault.getCode().getValue().toString(); if (fault.getMessage() != null) { msg = fault.getMessage().getValue();
if (fault.getCode() == null) { log.debug("{} Resolved Fault contained no FaultCode, using configured default", getLogPrefix()); final XMLObjectBuilder<FaultCode> faultCodeBuilder = final FaultCode code = faultCodeBuilder.buildObject(FaultCode.DEFAULT_ELEMENT_NAME); code.setValue(defaultFaultCode); fault.setCode(code); buildFaultString(fault, faultString); } else { fault.setMessage(null); fault.setDetail(null); fault.setActor(null);
/** {@inheritDoc} */ public void prepareContext() throws MessageEncodingException { MessageContext<MessageType> messageContext = getMessageContext(); XMLObject payload = null; Fault fault = SOAPMessagingSupport.getSOAP11Fault(messageContext); if (fault != null) { log.debug("Saw SOAP 1.1 Fault payload with fault code, replacing any existing context message: {}", fault.getCode() != null ? fault.getCode().getValue() : null); payload = fault; messageContext.setMessage(null); } else { payload = messageContext.getMessage(); } if (payload == null) { throw new MessageEncodingException("No outbound message or Fault contained in message context"); } if (payload instanceof Envelope) { storeSOAPEnvelope((Envelope) payload); } else { buildAndStoreSOAPMessage(payload); } }
faultObj.setCode(faultCodeObj); faultObj.setMessage(faultStringObj); .buildObject(FaultActor.DEFAULT_ELEMENT_NAME); faultActorObj.setValue(faultActor); faultObj.setActor(faultActorObj); faultObj.setDetail(detailObj);
/** {@inheritDoc} */ public void prepareContext() throws MessageEncodingException { final MessageContext<SAMLObject> messageContext = getMessageContext(); XMLObject payload = null; final Fault fault = SOAPMessagingSupport.getSOAP11Fault(messageContext); if (fault != null) { log.debug("Saw SOAP 1.1 Fault payload with fault code, replacing any existing context message: {}", fault.getCode() != null ? fault.getCode().getValue() : null); payload = fault; messageContext.setMessage(null); } else { payload = messageContext.getMessage(); } if (payload == null) { throw new MessageEncodingException("No outbound message or Fault contained in message context"); } if (payload instanceof Envelope) { storeSOAPEnvelope((Envelope) payload); } else { buildAndStoreSOAPMessage(payload); } }