void setDetail(SoapFault fault, Object detail, EncoderDecoder codec) throws Exception { String name = fault.getSubCode().getLocalPart(); Element element = null; if (RMConstants.INVALID_ACKNOWLEDGMENT_FAULT_CODE.equals(name)) { element = codec.encodeSequenceAcknowledgement((SequenceAcknowledgement)detail); } else if (!RMConstants.CREATE_SEQUENCE_REFUSED_FAULT_CODE.equals(name) && !RMConstants.WSRM_REQUIRED_FAULT_CODE.equals(name)) { element = codec.encodeIdentifier((Identifier)detail); } fault.setDetail(element); }
public String toString(Fault f) { SoapFault sf = (SoapFault)f; org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message("SEQ_FAULT_MSG", LOG, new Object[] {sf.getReason(), sf.getFaultCode(), sf.getSubCode()}); return msg.toString(); } }
public SoapFaultException(MuleEvent event, SoapFault soapFault, MessageProcessor failingMessageProcessor) { super(CoreMessages.createStaticMessage(soapFault.getMessage()), event, soapFault, failingMessageProcessor); this.faultCode = soapFault.getFaultCode(); this.subCode = soapFault.getSubCode(); this.detail = soapFault.getDetail(); }
private Object[] invoke(SoapRequest request, Exchange exchange, MessageDispatcher dispatcher) { String operation = request.getOperation(); XMLStreamReader xmlBody = getXmlBody(request); try { Map<String, Object> ctx = getInvocationContext(request, dispatcher); return client.invoke(getInvocationOperation(), new Object[] {xmlBody}, ctx, exchange); } catch (SoapFault sf) { throw new SoapFaultException(sf.getFaultCode(), sf.getSubCode(), parseExceptionDetail(sf.getDetail()).orElse(null), sf.getReason(), sf.getNode(), sf.getRole(), sf); } catch (Fault f) { if (f.getMessage().contains("COULD_NOT_READ_XML")) { throw new BadRequestException("Error consuming the operation [" + operation + "], the request body is not a valid XML"); } throw new SoapFaultException(f.getFaultCode(), parseExceptionDetail(f.getDetail()).orElse(null), f); } catch (DispatchingException e) { throw e; } catch (OperationNotFoundException e) { String location = wsdlModel.getLocation(); throw new BadRequestException("The provided [" + operation + "] does not exist in the WSDL file [" + location + "]", e); } catch (Exception e) { throw new SoapServiceException("Unexpected error while consuming the web service operation [" + operation + "]", e); } }